Include content from one page to another

Another shortcode option (add the following to your functions.php). With this one, you have two options. You can query by the post/page ID (will work for any post type), or the page name/slug (only works for pages). // Add “Show Content” Shortcode function wpse_120886_show_content( $atts ) { // Attributes $a = shortcode_atts( array( ‘id’ => … Read more

Hiding Page by Title from Editing

You can hide pages using a filter on pre_get_posts. That can be done setting ‘post__not_in’ argument, but that argument need page ids. And you don’t know the id before the page is created. For that reason, tou can run an additional query to retrieve the ids based on the titles, or better on the slugs … Read more

How to modify the default WordPress ‘Pages’ widget to have titles on the anchor tags?

A fast and short solution would be – function wpse_list_pages( $output ){ $output = preg_replace( ‘/<a(.*?)>(.*?)<\/a>/’, ‘<a$1 title=”$2″>$2</a>’, $output); return $output; } add_filter(‘wp_list_pages’, ‘wpse_list_pages’); And if you want a proper way, you could extend Walker_Page (ref: post-template.php) class and set the Pages Widget walker to class with widget_pages_args hook

Get all children page ID’s including parent by title

You have done this the hard way. WP_Query can do most of the work for you. function get_all_pages($page_title) { $page = get_page_by_title($page_title); if (empty($page)) return array(); $children = new WP_Query( array( ‘post_type’ => ‘page’, ‘post_parent’ => $page->ID, ‘fields’ => ‘ids’ ) ); array_unshift($children->posts,”{$page->ID}”); return $children->posts; } $allpages = get_all_pages(‘Sample Page’); var_dump($allpages); It is late, and … Read more

How to use the same code for multiple pages?

Please show us your actual code, and don’t just describe what you implemented. In this particular case, it is vital to see how you tried to implement two occurrences of the code. Anyway, from what I understand, the following function should do what you’ve asked for: add_action(‘wp_trash_post’, ‘wpse_136052_do_not_delete’); function wpse_136052_do_not_delete($id) { if (in_array(get_post($id), array( get_page_by_title(‘About’), … Read more

Personal page for every user (not just authors)

I guess what you’re looking for is an author template. You can create an author.php in your template folder and arrange the information in there like you want to. It will be a general template for every user then. You can access the author page if you visit example.com/author/author-slug/ To give an example: http://bookish.brokenstars.de/author/fyn/ I’m … Read more

Missing parent page attribute

Ok, I solved it myself. The Drop-down list is only displayed if there is at least one public page. Why there is not just “There is no public page” text instead of hiding the list without a hint!? I have set every page to private, so that the list was not displayed at all. If … Read more

Page title not showing up

to show the page title for the page set as the ‘blog’ or ‘posts page’, you need to add some code, maybe via a filter on wp_title(); example: add_filter( ‘wp_title’, ‘wpse_174379_show_posts_page_wp_title’ ); function wpse_174379_show_posts_page_wp_title( $title ) { if( get_option( ‘page_for_posts’ ) ) { $posts_page = get_post( get_option( ‘page_for_posts’) ); $title=” ” . $posts_page->post_title . ‘ … Read more

Show child pages and sibling pages on the child page

You can query pages that have same parent excluding the page itself: wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&exclude=”.$post->ID); Use parent instead of child_of to get only direct siblings without children of the siblings.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)