This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Tagged: 

Fallback Banner images for blog posts and tag pages

  • Creator
    Topic
  • #23520
    Mark Wiard
    Participant

    I think I have designed myself into a box that I can’t quite get figured out. On regular pages like this:

    http://verypink.com/AjBfTTxP95/about/

    I can add a banner image, and have it show the page title. This is perfect, and works on my main blog page also.

    http://verypink.com/AjBfTTxP95/blog/

    once I get to an actual post

    http://verypink.com/AjBfTTxP95/2015/10/07/giveaway-knitters-pride-16-platina-needle-set/

    no banner image. I can add these one at time to each post using the banner feature. The site has 600 posts, so I cannot really practically do this. I need some kind of fallback banner image capability. This should work for other dynamic pages like the search results and tag pages.

    Any suggestions for how to do this?

    I could also be happy with a random image popping into this location, and ditch the built in banner feature. There are lots of plugins that will do this, but none of them will put in the post/page title which makes the whole thing work for me.

    Any suggestions?

    mark

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #23524
    Jason Bobich
    Keymaster

    Hi Mark,

    This actually was discussed previously a bit here. It is possible and quite doable.

    There are several approaches you could take here. In this example, I’m filtering onto the main configuration of the page load. I’m checking to see if it’s a single post, and then I’m manually applying the banner created in the WordPress admin from some other page with ID 123.

    So effectively I’ve set up a banner on some page, and then am applying it to all single posts.

    function my_post_banner( $config ) {
    
        if ( is_single() ) {
            $config['banner'] = get_post_meta( 123, '_tb_banner', true ); // 123 is the ID of the page w/banner
        }
        
        return $config;
    }
    add_filter('themeblvd_frontend_config', 'my_post_banner');

    Helpful to understand WordPress conditionals: https://codex.wordpress.org/Conditional_Tags

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.