How can I make different page templates for one category?

Make 1 template, and do a conditional on the meta info to either include a different stylesheet, or a entire different file altogether. $colour = get_post_meta(the_ID(), ‘color’); switch($color) { case ‘red’: include(‘category-car-red.php’); // or just different CSS break; case ‘green’: include(‘category-car-green.php’); // or just different CSS break; // etc }

Single page template

Yes, even for custom page templates, you will need to have a loop in order to get the title and content. Try the following: <?php /* Template Name: Use Case Template */ ?> <?php get_header(); ?> <div class=”wrap”> <?php if(have_posts()): while(have_posts()): the_post; ?> <div class=”leftcol”> <h3 class=”usehd”> <?php the_title(); ?> </h3> <div class=”hd-div”> </div> <div … Read more

Fetching Image from other post/page with custom type

You can achieve that in many ways , but providing that you use a relatively new wordpress, you should use the_post_thumbnail(). you define it in functions.php , like so : add_theme_support( ‘post-thumbnails’ ); //thumnails set_post_thumbnail_size( 150,230, true ); // defaultpost thumbnails add_image_size( ‘your-custom-name-2’, 400, 9999 ); // some size thumbnail add_image_size( ‘your-custom-name-2’, 400, 300,false ); … Read more

Page template anomaly

You created a specific page template for a page called ‘about’ but your page is called ‘About Us’. Try creating a page named ‘About’ or renaming your file to page-about-us.php. Also use the cleaner formatting involving new lines: <?php /* Template Name: Example Page */ get_header(); ?> You’re also not checking if there is a … Read more

Dynamically change Custom Post Type Template OR Change Permalink?

You can use the rewrite parameter of $args dynamically. Because the post type is registered every time wordpress loads (not just the first time register_post_type() loads), you can set any of the $args dynamically so long as the $post_type slug stays the same. See the codex documentation on register_post_type() for a list of the arguments … Read more

Template tag for /page/# structure

WordPress provides is_paged() which returns true on any archive or blog that stretches over multiple pages. This isn’t what you want, but the is_paged Codex article tells us where to go: If you need to check which page of the blog you are on, you can look in $wp_query->query_vars[‘paged’]. Remember that inside functions you might … Read more

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