Hot answers tagged

4

That's because the main query is being discarded and replaced with your custom query. You've not told your custom query to look for that tag, so why would it? You might also notice your pagination is broken for the same reason, you've not told the new query which page you're on, so why would it pull the right page? What's more, that main query is expensive! ...


2

1 If you look at the source code of get_the_title you will see that there is no difference between the two ways of writing the same thing, because if you call it without a parameter it is supposed to be the current ID. 2 There is no substantial difference between the two loops you use. All go through the same amount of items and do the same thing with it. ...


1

You could do this with custom shortcodes or in some plugins with saved layouts. Many pagebuilder give the option to save predefined layouts. Try out this plugin if you want to create the predefined layouts programmatically. https://github.com/WebDevStudios/WDS-Simple-Page-Builder


1

/YOUR_THEME/page-templates/ will only work for custom page templates assigned on the admin page edit screen, not for page-$slug or page-$id named templates. The correct filter hook in my view is page_template, but you don't (I assume!) want to throw out any other possible templates for your pages, not least because you're bound to have some pages on your ...


1

Something went wrong with your installation. As commented by @Sumit get_header() is a core function and cannot be undefined. To troubleshoot: Reinstall WordPress and enable WP_DEBUG in wp_config.php: define( 'WP_DEBUG', true ); If it is on a live site you might want to use this instead: define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ...


1

Within the wp_get_document_title() function we have: // If it's a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: search phrase */ $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); so you could hook into the ...


1

In author.php: <?php get_template_part('custom-author-file'); Alternatively, rename your custom-author-file.php to author.php. The URL being used in this case isn't relevant, as a template doesn't determine the URL used, it's the other way around. However, I suspect there is more to your question you haven't explained



Only top voted, non community-wiki answers of a minimum length are eligible