How to return a specific attribute
How to return a specific attribute
How to return a specific attribute
In the theme you have choosen (twenty ten) – the main Container where you page / post is posted is the div: <div id=”content” role=”main”> <!– YOUR CONTENT IS PUBLISHED HERE –> </div> . This div has a maximum width of 640 pixels… if you want to change that you can do one of three … Read more
This hooks onto the wp_insert_post_data filter, and checks if the post to be inserted is both a page and an auto-draft (which happens when you first create a new post/page). add_filter( ‘wp_insert_post_data’, ‘wpse_59007_set_default_page_parent’ ); function wpse_59007_set_default_page_parent( $data ) { if ( $data[‘post_status’] == ‘auto-draft’ && $data[‘post_type’] == ‘page’ ) $data[‘post_parent’] = 495; return $data; }
Don’t use custom page templates for structural layout changes. Use custom post metadata instead, and then output conditional CSS rules (or even custom HTML markup, though that’s probably not necessary here) based on the value of the custom post metadata.
The parameter that controls post-type hierarchy is called ‘hierarchical’, and is set when the post type is registered via register_post_type(). WordPress core registers the ‘post’ post-type with ‘hierarchical’ => false. To override this setting, refer to this question.
Instead of setting yourtemplate.php as the default, why don’t you change the default template, and put the original default in yourtemplate.php? AKA swap them? Otherwise you’ll have to go back through all your posts and change them, and, mess around with complicated filters that might not work 100%
Yes, and one way is by accessing the global $post variable and then check if it’s for a post of the post type (or any custom post types). E.g. add_filter( ‘default_page_template_title’, function ( $label ) { global $post; if ( ‘post’ === get_post_type( $post ) ) { return __( ‘new default name for posts only’, … Read more
Scan the files for a comment header that might have Template Name: Programs present. The template drop-down is populated by the comment header in files. I believe this is only true for files in the theme’s root folder and from a template sub-folder within the theme (if one exists).
Make sure you don’t leave any space after “template name” and full column. Right <?php /* Template Name: About */ ?> Wrong <?php /* Template Name : About */ ?>
From the source code the function wp_dropdown_pages uses get_pages() and this function uses different attributes than WP_Query or get_posts(). It uses authors instead of author. Note from the codex: authors (string) Only include the Pages written by the given author(s) Note: get_posts() uses the parameter ‘author’ instead of ‘authors’.