Tag Info

New answers tagged

3

Your problem is that you didn't wrap it in a callback, but executed it immediately when functions.php was loaded by core. By then the global $wp_query object isn't initialized fully and the is_category() etc. wrappers can't deliver what you are expecting them to do. So your if/else checks should be moved inside the callback like this: add_filter( ...


1

A couple issues here... First, the init hook is too early for WordPress to know which page template you're going to be using. (So the is_page_template() function will always return false). Just go ahead and hook your function to wp_enqueue_scripts (which you're probably already doing for your global CSS / JavaScript). And then check for the page template ...


1

If you want all of the visual aspects of the second theme on that one page, you could do something like this. It's hacky and I wouldn't recommend doing this but it's your question! From where you say you're at now (separate header/footer/page.php) you simply need to update the URLs that call in the CSS and other support files. These may include a "pieces, ...


1

The codex is there to be used and should be your first stop. There is a complete page on conditional tags To exclude the archive page, use is_archive(). EDIT 1 Mark has a valid point. I didn't understand you well, and maybe myself as well :-) Your problem is using the || and && operators Here is your code if ( !is_home() || ...


2

Check out this Alternative <?php // in the loop: $template = get_page_template_slug( get_the_ID() ); if (in_array($template,array('home1','home2')) ) ){ // Yep, Do your stuff } // anywhere: $template = get_page_template_slug( $some_post_ID ); if (in_array($template,array('home1','home2')) ) ){ // Yep, Do your stuff } ?>


0

You could use the NOINDEX, FOLLOW meta robots tag on the this 'stack' page, or the individual pages. <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> This lets search engines crawl the page and all links on it, but they will not index the page and so any content on it won't get counted as duplicate content. The code goes within the <head> ...


0

add_filter( 'template_include', 'wpsites_home_page_template', 99 ); function wpsites_home_page_template( $template ) { if ( is_singular( 'page' ) ) { $new_template = locate_template( array( 'single_page-template.php' ) ); if ( '' != $new_template ) { return $new_template ; } } return $template; } You ...


1

This has nothing to do with caching, but with form auto-completion. It is happening because the browser is set to store form content. To avoid this, you should generate a random code and add it to the name attribute of your input tags. Then send the random generated number trough another hidden input so you can retrieve the data on the other side.


1

In the link all the content such as calendar, categories, archive, etc. are coming from the sidebar widget which most probabily defined into your page.php layout. something like: <?php get_sidebar( 'content' ); ?> You need to remove this kind of sidebar code from the page.php file to not display that information.


1

My guess is that you have not defined a page.php template in your theme, so pages are being displayed using index.php which includes a sidebar with widgets and comment form. Edit: Looking at the code in your updated question, you can remove the following: // If comments are open or we have at least one comment, load up the comment template. if ...


1

WooCommerce uses a custom post type called product for its product. Your shop page appears to be looking for a products archive. I can tell this because of the slug - post-type-archive-product Have you tried renaming your custom shop template file archive-product.php? This should override the default archive template.


-1

Please set the template to Default template in the page edit. Thanks, sharma Chelluri



Top 50 recent answers are included