Hide add new page button

This can be achieved easy enough with just CSS. First we are going to add a function that will output a class to the body tag based on what role the user is. Then we will enqueue a stylesheet to show up in the admin. Then use the class in the body to target and … Read more

Created pages not showing up in ‘All Pages’ list

The problem was actually the pages having “no language” and WPML seems to hate this. So I just deleted all those pages and re-inserted them with the proper WPML language attributes: // (…) // Create the page $customPage[‘id’] = wp_insert_post( $pageParams ); // Check if WPML parameters are needed if (has_action(‘wpml_set_element_language_details’)) { // Set WPML … Read more

Password Protected Page Not Displaying Content After Entering Password

I’ve also struggled with this. Although I still don’t really understand what causes the problem, I’ve managed to bypass it, by installing a login redirect plugin and changing the standard login URL from www.yourwebsite.com/wp-login.php to www.yourwebsite.com/login. The plugin I used can be downloaded from https://nl.wordpress.org/plugins/rename-wp-login/, but I’m pretty confident that any login redirection plugin would … Read more

One page – Multiple parents?

Not possible natively, parent is simply single field in database. There are plugins that allow to create more complex relationships, such as Posts 2 Posts but it’s unlikely to work with just any widget. Alternatively you can create custom menu with arbitrary structure and use native widget to display it in sidebar.

Can I apply a WP theme to a specific custom page template?

In fact there is, using template_redirect, which you would put in the functions.php file – Here’s what I use: function uniquename_default_template() { if(get_post_type() == ‘posttype’) : /* You could use is_single() instead of get_post_type() == ” or any type of conditional tag) */ include(TEMPLATEDIR . ‘path/to/theme/file.php’); /* You could use TEMPLATEDIR to get a file … Read more

How to add pages to feed?

Adding the following code to your theme’s functions.php will solve your problem: // Add Pages to RSS Feeds function myfeed_request( $qv ) { if ( isset( $qv[‘feed’] ) && ! isset( $qv[‘post_type’] ) ) $qv[‘post_type’] = array( ‘post’, ‘page’ ); return $qv; } Found code here.

Editing Pages that Have Already Been Published

You can edit the page at any time after it is published. I would not recommend using maintenance mode, as then your entire site will be unavailable while you are editing the page. When you are editing, your site is unaffected until you click “Update” and save the changes to the published post. No users … Read more

How to create wordpress page that shows posts with specific tags?

I’m pretty sure I always read on here that new WP_Query() is recommended over query_posts. Additionally you can use the Transient API to improve performance on additional queries. Place this in whatever template where you’d like the list to display: // Get any existing copy of our transient data if ( false === ( $my_special_tag … Read more