Can I display submenus in groups, using wp_list_pages?
You could maybe choose to use a tree like that: Fruits Color1 Apple Watermelon Color2 Banana Lemon Level1 Level2 Level3 This way, you can, in your theme, hide the second level. Hope that helps.
You could maybe choose to use a tree like that: Fruits Color1 Apple Watermelon Color2 Banana Lemon Level1 Level2 Level3 This way, you can, in your theme, hide the second level. Hope that helps.
The code used to make this decision by WordPress is get_page_template(). The pagename version (page-{slug}.php) is pulled from get_query_var( ‘pagename’ ), you can use this in your page.php template to see what it outputs when visiting the child page. <?php echo get_query_var( ‘pagename’ ); ?> This mostly just means that the parent slug is ignored … Read more
You can use history.pushState to change the browser URL without reloading a page, and jQuery’s scrollTop method to scroll to the top of a specific element (and there are VanillaJS equivalents too). This will mimic the functionality of # anchors. However, like what Mark said, what your client wants is really weird. It is hard … Read more
One thing you could do is create page templates for complex pages and simply add the content through the editor, leave as little mark-up as possible in the editor. Another thing that might help is using the editor style (activated with add_editor_style() in functions.php) and defined in editor-style.css so the client has a better sense … Read more
On the admin side, you could update the meta data for the page-post_type programmatically: global $post; if ( ‘swiss_cheese’ === $post->post_parent AND is_admin() ) update_post_meta( $post->ID, ‘_wp_page_template’, ‘some_template.php’ ); On the visitor facing side, you can simply jump into template redirect: function wpse63267_template_include( $template ) { global $post; if ( ‘swiss_cheese’ === $post->post_parent ) { … Read more
you actually don’t need any ajax or server side action, simple see if the user has selected a parent page: add_action( ‘admin_head-post-new.php’, ‘publish_admin_hook_wpse_78690’ ); add_action( ‘admin_head-post.php’, ‘publish_admin_hook_wpse_78690’ ); function publish_admin_hook_wpse_78690() { global $current_screen; if( ‘page’ != $current_screen->post_type ) return; ?> <script language=”javascript” type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#publish’).click(function() { var parent_id = jQuery(‘#parent_id’).val(); if (parseInt(parent_id) > 0){ … Read more
Here’s one way to do it: Extending the post list table Let’s assume we want to target the post post type. The user interface we are after is the following: where we can simply order by the post content length and then use the bulk feature to delete the posts that are empty. We can … Read more
I think you want: if( get_page_by_title( ‘home’ ) == NULL ) create_pages_fly( ‘home’ ); Your original if condition said if the page exists (does not equal NULL), then create the page. Also, the 2nd argument should be a string, though it doesn’t really matter in this case since it’ll just default to ‘page’ anyway.
Here’s just a demo test for fun, just to see if this might be possible: Demo First we set the post’s password, the usual way: Then we create a custom field called wpse_extra_passwords that takes comma seperated passwords: These are the extra passwords for that post. Let’s define the following helper function, based on the … Read more
If you don’t force a title, and obviously do not know the id, the only way you can do it is by letting the user select which page to use, usually done in the theme’s options page, but can be done in the costumizer, or even as part of page editing