Forums

A little confused (7 posts)

  1. chuco61
    Member
    Posted 3 years ago #

    Im creating a primarily static site, however the programs page needs to be updated dynamically.

    What im looking to do is have a different header image on each page. How do i do this so that image 1 appears once about is clicked, then image 2 appears once programs is clicked and so forth

    my nav links are currnetly absolute links not using the wp_list_pages

    please see maclaarte.org/wordpress

  2. kapiljain.in
    Member
    Posted 3 years ago #

    You can do this by adding custom field.

    You will easily found help on WordPress Custom Fields.

    Some plugins also available for that, Custom Field Template one of these

  3. chuco61
    Member
    Posted 3 years ago #

    there isnt a simple function to accomplish this? i cant seem to get any to work.

    my site is less than 10 pages.

  4. kapiljain.in
    Member
    Posted 3 years ago #

    I think it is the best practice and simplest way of doing that.

    By using custom field you can easily manage images from admin panel of wordpress.

    Just use this Custom Field Template plugin, it make the task even more simple.

  5. chuco61
    Member
    Posted 3 years ago #

    maybe im not understanding their documentation. once i add the plugin, do i create a div where i want the custom image header then place the image location into the custom filed?

  6. kapiljain.in
    Member
    Posted 3 years ago #

    Yes your are right. Do the following steps:

    1. Create a custom field using plugin or manually (for exmaple: header_pic).
    2. Upload an image for header in media library.
    3. Copy the path of images and paste into the custom field.
    4. Retrieve the url in an variable from custom field in your template page by using <?php $image_url = get_post_meta($post->ID, 'header_pic', true); ?>
    5. Now you may use it as you want.

  7. chuco61
    Member
    Posted 3 years ago #

    im still not able to get it to work. i beginning to understand a little.

    i added under my about PAGE custom filed name is header_pic then value is <img alt="about us" src="http://maclaarte.org/wordpress/wp-content/themes/NEWmacla/images/programs-bg.jpg"/>

    then in my header.php where i want the image to appear i have <?php $image_url = get_post_meta($post->ID, 'header_pic', true); ?>

    im not sure if get_post_meta is an issue since im adding this to the pages not a post

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.