WordPress.org

Ready to get started?Download WordPress

Forums

Code Question (2 posts)

  1. isay81
    Member
    Posted 3 years ago #

    I want to add this plug in to my new site. In the following directions it tells me to drop this line of code into the header template, but it doesn't say where. The Theme I am using is Twenty Ten and the site is
    http://www.agronotec.com
    This is the plug in:dynamic-headers/custom-header.php
    Directions:1

    Option 1 (Recommended): Simply drop the this line of code into your theme file that controls your header (usually header.php)

    Note: The location to add this code can vary widely from theme to theme and depending on your theme's css settings you may have to use Option 2 and modify the CSS of your theme **BACKUP ANY THEME FILES BEFORE MODIFYING**

    <?php if(function_exists('show_media_header')){ show_media_header(); } ?>

    This will automatically determine what type of media you are using and generate the appropriate code to insert it. No other coding is required on your part.

    Option 2: You can use this line of code to simply get the URL of the media for a particular post or page. This will allow you to do some more advanced things and embed the media yourself if you know what you are doing.

    <?php if(function_exists('dh_get_page_image_url')){ $dynamic_header_url = dh_get_page_image_url(); } ?>

    You can then use the variable $dynamic_header_url however you see fit. It will contain the full path to your media file for that particular page/post, including any default media that should be shown.
    It is advised that most users simply use Option 1 if at all possible, as it is significantly more simple.
    Note: This function can return NULL or the string 'None' if there are no headers for the current page.

  2. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    In your header.php http://wordpress.pastebin.com/BedUqJht you will see the rest right here.

    Sorry I had to use pastebin.com because longer codes breaks the design here.

    Enjoy,
    Emil

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.