How to Change 404 page title

I would use the wp_title filter hook: function theme_slug_filter_wp_title( $title ) { if ( is_404() ) { $title=”ADD 404 TITLE TEXT HERE”; } // You can do other filtering here, or // just return $title return $title; } // Hook into wp_title filter hook add_filter( ‘wp_title’, ‘theme_slug_filter_wp_title’ ); This will play nicely with other Plugins … Read more

How To Create A Paginated List Of All Categories On My Site?

Paging a list of terms/categories/tags are quite easy, and to achieve that, you need minimal info. Lets look at we need the amount of terms the amount of terms per page get_terms() (Just note, the usage of get_terms() have changed in version 4.5). You can also use get_categories() if you wish, get_categories() is just a … Read more

Is there a WordPress plugin that registers a plugin file as a custom page template?

Like Rarst answered you can really do that without editing core files or remove the page attributes metabox and create your on using the same code with a bit of modification. the code below is the code for the /admin/include/meta-boxes.php and i added the a comment to show where your extra page template options would … Read more

How can I add an option to the Page Template list from a Plugin?

Filters? Anyone? There’s no filter there to help: page_template_dropdown($template); is used to build the drop down and it’s not filterable. Sneaking into the Templates Array? To build the drop downs contents, the core meta box uses get_page_templates(). From inside, the function looks like the following: $themes = get_themes(); $theme = get_current_theme(); $templates = $themes[$theme][‘Template Files’]; … Read more

How to move page template files like page-{slug}.php to a sub-directory?

How Page Templates are loaded: According to the default WordPress Template Hierarchy, a page request loads a template based on the priority and naming as stated below: Custom Page Template: if defined in the page editor. page-{slug}.php page-{url-encoded-slug}.php: only for multi-byte characters. page-{id}.php page.php singular.php index.php Among these, singular.php and index.php are not actually page … Read more

How can I load a page template from a plugin?

You can use the theme_page_templates filter to add templates to the dropdown list of page templates like this: function wpse255804_add_page_template ($templates) { $templates[‘my-custom-template.php’] = ‘My Template’; return $templates; } add_filter (‘theme_page_templates’, ‘wpse255804_add_page_template’); Now WP will be searching for my-custom-template.php in the theme directory, so you will have to redirect that to your plugin directory by … Read more

Creating custom blog page template the right way

Don’t forget that WordPress was primarily designed to be a blogging CMS, so when it comes to theme development, developers often opt for a non-standard approach in exchange for the potential for more features. Theme developers have three options when they approach this, one of which (#2 below) you mentioned. Directly edit the index.php to … Read more

What does is_page_template() compare against?

Your condition should be written like this: if (is_page_template(‘path/file.php’)) { // Do stuff } I believe the confusion is a result of two things: The docs refer to “name” ambiguously. Specifying “file name” would make the documentation much more clear. The code behind is_page_template() shows the get_page_template_slug() function at its core. This function actually returns … Read more