Using permalinks, category slugs, and tag slugs

I was messing with my permalinks today for the same reason. And i ended up with a solution that worked great. You have to change your custom permalink structure to: /%category%/%postname%/ In the category base field just put a period mark: . and your permalinks will display in this form: CATEGORY PAGE mysite.com/blog/category-name/ POST PAGE … Read more

Mixing Tweets with Posts

I’ve done this with Twitter Tools. Basically it hooks up the blog to a Twitter feed, and for each new tweet creates a blog post. You can put twitter posts in a separate category (or add tags), and use that to style twitter-posts differently from regular posts, hide the comments field, whatever. Hope this helps … Read more

How to include the latest post of a specific category on a matching page

I have managed to solve this problem by creating my own code. In my content-excerpt.php template part, I have included the following, if(!is_page(‘Home’)){ $page = get_page(get_the_ID()); $custom = get_post_custom($page->ID); // I have added a custom field on the page, which contains the category id $custom_post = get_posts(array(‘numberposts’=>1, ‘category’=>$custom[‘Category Link’][0], ‘post_type’=>’post’, ‘post_status’=>’publish’)); $post = $custom_post[0]; } … Read more

Adding the_date inside tags around the_content

You could use the the_content filter, like below (untested). The only thing is, that will add the date pretty much everywhere that your posts show up on your site, unless you add some logic to determine where it’s being called from. If that’s OK, give it a shot. add_filter(‘the_content’, ‘add_post_date’); function add_post_date($content) { global $post; … Read more

Having trouble with the_post_thumbnail to display thumbnail with custom size

Always start with the Codex. According to the function reference for the_post_thumbnail(): Parameters $size (string/array) (Optional) Image size. Either a string keyword (thumbnail, medium, large, full), or any custom size keyword defined by add_image_size(), or a 2-item array representing width and height in pixels, e.g. array(32,32). Default: ‘post-thumbnail’, which theme sets using set_post_thumbnail_size. PLEASE NOTE: … Read more

Why aren’t my posts/pages showing up in my WordPress Theme?

Try this basic template layout <?php get_header(); # gets header.php contents if (have_posts()): # checks if there are any post available for this url while(have_posts()): # starts loop the_post(); # assigns $posts global the_title(); # outputs post title the_content(); # outputs post content endwhile; # ends loop endif; # ends conditional check get_footer(); # gets … Read more

Addition Text to Post Titles (Custom Post Types) in RSS

Since you’re defining $post_type, why not just use it instead? function wpbeginner_titlerss($content) { global $wp_query; $post_type = $wp_query->post_type; if( $post_type == ‘essays’ ) { $content=”Essay: “.$content; } elseif ( $post_type == ‘gallery’ ){ $content=”Gallery: “.$content; } elseif ( $post_type == ‘games’ ){ $content=”Game: “.$content; } else { $content = $content; } return $content; } add_filter( … Read more

current post with current author

A compacted version that does not load the globals yet calls upon them directly. if( is_user_logged_in() and // Force user validation… STUFF !empty($GLOBALS[‘post’]) and // Check if a $post exists in globals !empty($GLOBALS[‘current_user’]) and // Check if current_user exists in globals ($GLOBALS[‘current_user’]->ID == $GLOBALS[‘post’]->post_author) // Match User IDs ){ // This is your Author speaking, … Read more

Find attached images for one post type

Try this code and replace custom-post with your custom post type. $query = new WP_Query( array( ‘post_type’ => ‘custom-post’, ‘posts_per_page’ => -1 ) ); if( $query->have_posts() ){ while($query->have_posts()){ $query->the_post(); $image_query = new WP_Query( array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘image’, ‘posts_per_page’ => -1, ‘post_parent’ => get_the_ID() ) ); while( $image_query->have_posts() ) { … Read more