wordpress header leaks into body in a specific template
Can you be a little more specific on which part is ‘leaking’ into the body? It’s hard to tell without running any code and having other parts of the theme to look at.
Can you be a little more specific on which part is ‘leaking’ into the body? It’s hard to tell without running any code and having other parts of the theme to look at.
I think I understand what you’re talking about. You would like to allow users to choose the amount of columns to be used for the page/post they are creating. You want to use different template files to achieve the different template layouts. There are two ways of doing this. One is to use different template … Read more
Do you have the following line in your custom-page.php: <?php get_sidebar(); ?> ?
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 }
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
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
If ‘gallery’ is a taxonomy item (like a category) you could create a new page template (perhaps based on index.php) and then use the get_posts() function to return a list of posts in that category. That’s the process. Do you need more detail? If ‘gallery’ is a post format that may be a quite different … Read more
Going to use a site setup where each page has only one specific parent and where there is only one main menu and a sidebar that loads page children. Easier and clearer that way.
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
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