WordPress.org

Forums

Unique Headers
How to call in template (7 posts)

  1. befranga
    Member
    Posted 1 year ago #

    Hi and thank you for your great plugin. It seems to work very well however I want to display the header image in my custom template and I can't get it to work as needed. I want to show the header image in the category / page and if the header image exists display the image or otherwise the title. Can someone advise how to accomplish that?

    https://wordpress.org/plugins/unique-headers/

  2. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    If you haven't gotten the WordPress header image functionality working in your theme, then that is the first task you need to accomplish. Once that's working, the Unique Headers plugin should simply start working automatically :)

    If the WordPress header image is working, but the plugin still doesn't function, then I'd need to see the code to figure out what might be wrong.

  3. befranga
    Member
    Posted 1 year ago #

    Thank you very much, I can see it now! Is there any chance to display it in Custom Post Types?

  4. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    No, although I should add a filter to allow you to add support for that via another plugin. I'll try to remember to do that in a future version.

    In the mean time, you could open up the index.php file of the plugin and add an extra two lines at the bottom for your custom post-type. That is not an ideal solution though and you would need to avoid upgrading the plugin if you did it.

  5. befranga
    Member
    Posted 1 year ago #

    Thanks I will try. Can you give me a hint how do I call it in my CPT?

  6. Ryan Hellyer
    Member
    Plugin Author

    Posted 1 year ago #

    At the bottom of the index.php file in the plugin is this code:

    $args['post_type'] = 'page';
    new kdMultipleFeaturedImages( $args );

    You would need to replicate that, but with a different post-type instead of "page".

    So you'd copy the two lines and paste them below, but change where it says "page".

    This is a hacky way of doing it, but it should work. You may also want to change the plugin folder name and the name at the top of the index.php file, to avoid WordPress asking you to upgrade it (which would wipe out your changes).

    You may also be able to hook in at init and add it via a theme or plugin there, but I'm not certain. I'm also not promising that would work in future versions either, as I may modify the way that part of the plugin works in future as it doesn't look like I did a particular great job of it originally (ie: it doesn't let you easily add custom post-types in it's current form).

  7. pamtouw
    Member
    Posted 11 months ago #

    Hi,
    Sorry to bump up an "old" topic but I have added the code at the bottom of the index.php file and changed 'page' to 'te-koop', the name of my custom post type. I now have the custom header box in my custom post type but it doesn't show up on the page. Everything looks just fine in the backend but not on the frontend.
    It works just fine on my other, regular, pages. Can you maybe have look at it and tell me what I did wrong? My site is at http://leandra.hetparadepaard.nl and the page I am talking about is http://leandra.hetparadepaard.nl/te-koop/vam-bandolero/. The brown/black horse in the header is the standard/default header image but it should display the horse from the slideshow at the bottom of the page. Same goes for http://leandra.hetparadepaard.nl/te-koop/levante/

    TIA!
    Pam

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Unique Headers
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic