Page Template with Sidebar Naming Convention?

Templates in general have a strict naming convention according to the Template Hierarchy, regardless of sidebars included or not. WordPress uses template names according to this hierarchy to decide what template should be dished up for the specific page being viewed. Any template not following this naming conventions set out by the template hierarchy is … Read more

Can i exclude certain page templates for a specific role?

If you need to change the template used, you can use the template_include filter (change “itermediate-template.php” and “page.php” with correct file names of your template files): add_filter( ‘template_include’, ‘cyb_exclude_template_for_editors’, 99 ); function cyb_exclude_template_for_editors( $template ) { $user = wp_get_current_user(); if( in_array( “editor”, (array) $user->roles ) && is_page_template( “itermediate-template.php” ) ) { $new_template = locate_template( array( … Read more

How are the HTML classes generated?

By default WordPress adds lots of CSS classes in body tag automatically. These body classes are very useful for styling different sections/pages of site without needing to edit theme files unnecessarily. For example WordPress add home CSS class on website front page and blog class on blog posts index page. Similarly in your case, since … Read more

Custom permalink structure for remote content pages

I think your problem has several solutions. If you don’t want to have one entry in WP database for each remote item, a possible solution could be to have a page with property slug and add a rewrite rule to get the ID number: add_action( ‘init’, ‘cyb_property_rewrite_rule’ ); function cyb_property_rewrite_rule() { add_rewrite_rule( ‘^property/([0-9]{1,})/?$’, ‘index.php?pagename=$matches[1]&remote_ID=$matches[2]’, ‘top’ … Read more

Call a function for social sharing

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code To … Read more

Will placing custom templates in sub directory break any native WordPress functionality

Since WP 3.4 page templates can be stored in theme root folder or direct sub-directoryr, that is no problem. But rename page templates, which include moving files to other directories, will unassign that page templates for all pages currently using it. To reassign the page template, simply edit the page, and reselect the desired template. … Read more