If Child or Grandchild of Page
get_ancestors() will return the full parent page ID hierarchy for a given page ID which you could check against.
get_ancestors() will return the full parent page ID hierarchy for a given page ID which you could check against.
Since I don’t know the complete scope of the project I can only give a suggestion on what I would do. Since you will be using a page for placing the 3 images with title and excerpt, I’d create a custom page template that has two loops. The first loop would use query_posts to bring … Read more
Most likely, that comments.php file is being included or required more than once. You can make sure that any call to that file is done with include_once or require_once to prevent that issue. Otherwise, a safe workaround would be to wrap the file contents with: if ( ! function_exists( ‘basey_comment’ ) ) : # code … Read more
I think that will only work in the loop, but what you can do outside of the loop is use <?php if (get_post_type() == ‘pretty-little-liars’) { echo ‘<div id=”headerimg”><img src=”http://tv-cafe.com/wp-content/uploads/2012/08/liars.png”></div>’; } ?>
Preliminary Tasks Create a directory within your theme to contain your layout thumbs. Add layout thumbs to reflect the file names of your template. The following script uses the format tpl-homepage.php. The image would be named homepage.jpg. Please note, the following is a proof-of-concept. Approach 1: Only JavaScript Load the following only for post.php and … Read more
When I want to change a specific part of template, such as header OR footer then I use conditions like this – if(is_404()) { get_header(`error`); //loads header-error.php } else { get_header(); //loads header.php } In your case, you want to load a completely different template, Now the only action hook I can imagine is – … Read more
Untested, but I’d start with something like this: add_action( ‘wp’, ‘your_function’, 3 ); function your_function(){ if ( is_page_template( ‘some-template.php’ ) ) { if( some condition ) locate_template( array( ‘some-other-template.php’ ), true ); else return; } else return; }
I always name them like so: page-name.php; This keeps my page templates nicely together + in some cases this can make your code easier, for example… <?php // Get the file called loop-page.php get_template_part( ‘loop’, ‘page’ ); ?> A quick Google revealed also this http://wp.tutsplus.com/tutorials/organizing-and-naming-your-themes-template-files-for-clarity-and-convenience/ Cheers
Seeing the image you posted, you have two sane options: Implement a frontend add/edit UI Hide the posts admin UI and build your own Considering that eitherway a rewrite is needed, I recommend using the frontend. If you really want, you could hide all the metaboxes etc on the edit page and add your own … Read more
If that’s the case you are going about it the wrong way. You should use WP_Ajax_Response to send the comment, or just redirect the the same page. Duplicate content is not what WP is intended for.