Detect tag page and include an Image for that specific tag

Here are 2 solutions: Using Tag titles <?php switch( single_tag_title( ”, false ) ) { case ‘Books’ : include ‘tags/books.php’; break; case ‘Tables’ : include ‘tags/tables.php’; break; default : break; } ?> Using tag slugs: <?php if ( is_tag( ‘books’ ) ) { include ‘tags/books.php’; } else if ( is_tag( ‘tables’ ) ) { include … Read more

Comments and pingbacks issues

Actually, after trying a lot more I figured out that it was actually something quite simple I just forgot. Apart from the code in the comment.php, you also have to change this in your single.php: <?php comments_template(); ?> to <?php comments_template(”, true); ?> And that did the trick! I leave this here for future reference … Read more

Why does this search.php not work?

I see at least two potential issues: You have if ( have_posts() ) : twice. Here: <?php if ( have_posts() ) : ?> <h1 class=”page-title”><?php printf( __( ‘Search Results for: %s’, ‘nothing’ ), ” . get_search_query() . ” ); ?></h1> And here: <ul id=”post-list”> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> The get_template_part() … Read more

marking a post that was sticky on category template

Check if »sticky« There’s the is_sticky()–Conditional Tag, which you can read about in core here. How-to mark as »sticky« This works for posts, that have the “stick to the front page” check box checked: How »sticky« works internally So basically the function checks if the post-ID is inside get_option( ‘sticky_posts’ );. That means that you … Read more

If statement for is_author of a post

You can access the posts author (inside the loop) with the global $post; echo $post->post_author If your sidebar comes after your main content (in code), then you could populate a global array (not the best solution, but ok). // in the loop: Add each author to the global $post_authors array $post_authors[] = $GLOBALS[‘post’]->post_author; // in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)