Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ProsperoDK

    (@prosperodk)

    Thanks Glen, I have seen that block also, but as far as I can see it shows all the categories of the blog with or without post-count depending of what you choose. Also its a widget more for a sidebar.

    What I’m looking for is to format the categories of a single blog post, preferably without having to poke around in the PHP-code myself.

    /René

    Forum: Fixing WordPress
    In reply to: Dynamic Stylesheet

    I’ve been helping my father getting his new website up and running. We are using WordPress more as a CMS instead of a blog with pages in a hierarchical structure.

    He wanted to have a different header image for each page (so the image related to the text on the page.)

    This wasn’t easy to accomplish until I found this thread.

    So with a few minor alterations this worked for me.

    I’m using the page-ID to name the header-image since that is easy for my father to find in the admin pages.

    And I had to change
    body { background-image:
    to
    #header { background:

    This is what I ended up that worked for me.

    <?php
    
    function dynamic_stylesheet() {
    
    global $post;
    $dpname = $post->ID;
    
    if (is_page() || is_single()) { ?>
    
    <style type="text/css">
    #header { background:url("<?php bloginfo('template_directory') ?>/images/banner/panorama.<?php echo $dpname ?>.jpg"); }
    </style>
    
    <?php } }
    
    add_action('wp_head','dynamic_stylesheet');
    
    ?>

    If there’s no specific header image for that page it just uses the default header image.

    So thank you doodlebee for your code 🙂 It worked like a charm.

Viewing 2 replies - 1 through 2 (of 2 total)