انجمن


افزودن ویژگی سربرگ و پس زمینه سفارشی به پوسته  (۲ نوشته)

  • ياسر

    آفلاین
    عضو
    تعداد نوشته‌ها: ۳۹
    تشکر شده: ۲۶ بار
    # نوشته شده: ۱۲ سال پیش
    ۱۳ فروردین ۱۳۹۱ - ۱۰:۳۱

    سلام به اساتید و دوستان وردپرسی
    لطفا نگید این رو

    <?php
    //Check see if the customisetheme_setup exists
    if ( !function_exists('customisetheme_setup') ):
        //Any theme customisations contained in this function
        function customisetheme_setup() {
            //Define default header image
            define( 'HEADER_IMAGE', '%s/header/default.jpg' );
    
            //Define the width and height of our header image
            define( 'HEADER_IMAGE_WIDTH', apply_filters( 'customisetheme_header_image_width', 690 ) );
            define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'customisetheme_header_image_height', 115 ) );
    
            //Turn off text inside the header image
            define( 'NO_HEADER_TEXT', true );
    
            //Don't forget this, it adds the functionality to the admin menu
            add_custom_image_header( '', 'customisetheme_admin_header_style' );
    
            //Set some custom header images, add as many as you like
            //%s is a placeholder for your theme directory
            $customHeaders = array (
                    //Image 1
                    'perfectbeach' => array (
                    'url' => '%s/header/default.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/pb-thumbnail.jpg',
                    'description' => __( 'Perfect Beach', 'customisetheme' )
                ),
                    //Image 2
                    'tiger' => array (
                    'url' => '%s/header/tiger.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/tiger-thumbnail.jpg',
                    'description' => __( 'Tiger', 'customisetheme' )
                ),
                    //Image 3
                    'lunar' => array (
                    'url' => '%s/header/lunar.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/lunar-thumbnail.jpg',
                    'description' => __( 'Lunar', 'customisetheme' )
                )
            );
            //Register the images with WordPress
            register_default_headers($customHeaders);
        }
    endif;
    
    if ( ! function_exists( 'customisetheme_admin_header_style' ) ) :
        //Function fired and inline styles added to the admin panel
        //Customise as required
        function customisetheme_admin_header_style() {
        ?>
            <style type="text/css">
                #wpbody-content #headimg {
                    height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
                    width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
                    border: 1px solid #333;
                }
            </style>
        <?php
        }
    endif;
    
    //Execute our custom theme functionality
    add_action( 'after_setup_theme', 'customisetheme_setup' );

    به توابع پوسته و این رو

    <img id="headerimg" src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="Header image alt text" />
    
    ?>

    به سربرگ.پی اچ پی اضافه کن تا سربرگ سفارشی فعال بشه و بعد

    add_custom_background();

    رو به توابع پوسته برای پس زمینه سفارشی!
    چون این کارو کردم نشد
    البته تغییرات لازم رو تو کدها داده بودم و این هایی که ایجاست کدهای خام هستن
    اگه دوستان راهنمایی کنن ممنون می شم

  • Gadgetiha.ir

    آفلاین
    عضو
    تعداد نوشته‌ها: ۶۳
    تشکر شده: ۱۶ بار
    # نوشته شده: ۱۱ سال پیش
    ۱۷ فروردین ۱۳۹۱ - ۰۸:۳۰

    tickblog گفت:
    سلام به اساتید و دوستان وردپرسی
    لطفا نگید این رو

    <?php
    //Check see if the customisetheme_setup exists
    if ( !function_exists('customisetheme_setup') ):
        //Any theme customisations contained in this function
        function customisetheme_setup() {
            //Define default header image
            define( 'HEADER_IMAGE', '%s/header/default.jpg' );
    
            //Define the width and height of our header image
            define( 'HEADER_IMAGE_WIDTH', apply_filters( 'customisetheme_header_image_width', 690 ) );
            define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'customisetheme_header_image_height', 115 ) );
    
            //Turn off text inside the header image
            define( 'NO_HEADER_TEXT', true );
    
            //Don't forget this, it adds the functionality to the admin menu
            add_custom_image_header( '', 'customisetheme_admin_header_style' );
    
            //Set some custom header images, add as many as you like
            //%s is a placeholder for your theme directory
            $customHeaders = array (
                    //Image 1
                    'perfectbeach' => array (
                    'url' => '%s/header/default.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/pb-thumbnail.jpg',
                    'description' => __( 'Perfect Beach', 'customisetheme' )
                ),
                    //Image 2
                    'tiger' => array (
                    'url' => '%s/header/tiger.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/tiger-thumbnail.jpg',
                    'description' => __( 'Tiger', 'customisetheme' )
                ),
                    //Image 3
                    'lunar' => array (
                    'url' => '%s/header/lunar.jpg',
                    'thumbnail_url' => '%s/header/thumbnails/lunar-thumbnail.jpg',
                    'description' => __( 'Lunar', 'customisetheme' )
                )
            );
            //Register the images with WordPress
            register_default_headers($customHeaders);
        }
    endif;
    
    if ( ! function_exists( 'customisetheme_admin_header_style' ) ) :
        //Function fired and inline styles added to the admin panel
        //Customise as required
        function customisetheme_admin_header_style() {
        ?>
            <style type="text/css">
                #wpbody-content #headimg {
                    height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
                    width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
                    border: 1px solid #333;
                }
            </style>
        <?php
        }
    endif;
    
    //Execute our custom theme functionality
    add_action( 'after_setup_theme', 'customisetheme_setup' );

    به توابع پوسته و این رو

    <img id="headerimg" src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="Header image alt text" />
    
    ?>

    به سربرگ.پی اچ پی اضافه کن تا سربرگ سفارشی فعال بشه و بعد

    add_custom_background();

    رو به توابع پوسته برای پس زمینه سفارشی!
    چون این کارو کردم نشد
    البته تغییرات لازم رو تو کدها داده بودم و این هایی که ایجاست کدهای خام هستن
    اگه دوستان راهنمایی کنن ممنون می شم

    دوست گرامی چرا از خود نظیمات وردپرس هدر و پس زمینه سفارشی رو اعمال نکردی؟
    اون جا که از این همه کد راحت می شدی؟

درباره‌ی این موضوع