Change Image depending on page path

If you are dealing with a category page, you would simply use conditional tags, as suggested by @milo: if ( is_category( ‘cat-1’ ) ) { $url=”my-background-image-url-1.ext”; } else if ( is_category( ‘cat-2’ ) ) { $url=”my-background-image-url-2.ext”; } remember, you could pass in a category slug as well as a category name or an array containing …

Read more

Set the Title of a Custom Post Type by code as Author’s Username

There’s actually some cool filters that allow you to pre-populate the title field and editor field, the one we need is default_title. Once in the hook, we need to get our user and display the name: function post_author_title( $post_title, $post ) { if( $post->post_type == ‘your_post_type’ ) { $user = wp_get_current_user(); $post_title = $user->display_name; } …

Read more

Different titles for static, posts, and every xy page

Ok solved. <?php if ( is_front_page() && !is_home() ) :?> <h1><a href=”https://wordpress.stackexchange.com/questions/175971/<?php echo esc_url( home_url(“https://wordpress.stackexchange.com/” ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></a></h1> <?php elseif ( is_home() && get_option(‘page_for_posts’) ): ?> <h1><?php echo apply_filters(‘the_title’,get_page( get_option(‘page_for_posts’) )->post_title); ?></h1> <?php else : ?> <h1><a href=”<?php echo get_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(”); ?></a></h1> <?php endif; ?> …

Read more

Add Image Before Posts Entry Title

This works fine for me when i test it. I did edit your code as you had a small error in the function name not matching. Also, you might want to add a conditional tag and wrap the shortcode in a div but otherwise it works. function adt_abovetitle($title){ //Return new title if called inside loop …

Read more

Changing the color of post title [closed]

Without all the info of what is actually happening I’m assuming that the title is output with the Song Artist and the Song Name together. But like you said with a dash in the middle. With that assumption, then you can accomplish this with a custom function that filters the_title before it’s output. Try putting …

Read more