Echo page path suffix only – not the title, path or permalink
Use the Post Object instead. When in the loop, do this: global $post; echo $post->post_name; That should do the trick.
Use the Post Object instead. When in the loop, do this: global $post; echo $post->post_name; That should do the trick.
The publish_page action is listed as deprecated. You can use the ‘transition_post_status’ hook to check if a page was published. function publish_page_interception( $new_status, $old_status, $post ) { if ( ($new_status != $old_status) && ($post->post_status == ‘publish’) && ($post->post_type == ‘page’) ) { if($post->post_parent > 0) { //do stuff } } } add_action( ‘transition_post_status’, ‘publish_page_interception’, 10, … Read more
Sounds like what you need is a page template. This will allow you to enter your PHP (and any other code) in the appropriate place to generate the content on the frontend. Starting with a copy of your theme’s current page.php file is usually a good place to start. Modify the main area with your … Read more
$mypages = get_pages( array( ‘parent’ => get_the_ID(), ‘sort_column’ => ‘ID’, ‘sort_order’ => ‘ASC’, ); foreach( $mypages as $page ) { // Modify this line to include ID of page where want to change the link if ($page->ID == $ID_OF_PAGE_THAT_SHOULD_BE_PDF_LINK) { // Modify this line to include your PDF link echo ‘<li><a href=”https://wordpress.stackexchange.com/questions/154920/YOUR_PDF_LINK_HERE”>’ . $page->post_title . … Read more
get_pages returns an array of post objects, so you would use foreach to iterate over each object and grab the ID and whatever else you want to use: <?php if ( $pages = get_pages( $args ) { echo “<select multiple>”; foreach ( $pages as $page ) { echo “<option value=”{$page->ID}”>{$page->post_title}</option>”; } echo “</select>”; } ?>
Reset your permalink from admin site. you may get page if there is a conflation with permalink.
If I understand correctly what you want, you want a ‘page in a page’. This is very easy. Just use this plugin. It has support for widgets and shortcodes. Especially the shortcodes will be interesting for you. The plugin description repeats that it’s mission is to bring your Facebook posts and Twitter feeds to your … Read more
To expand upon my comment: Top-level page? (q.1) global $post; $x = get_ancestors( $post->ID, ‘page’ ); if( ! $x ) { // there are no ancestors, therefore this is a top-level page } Childless page? (q.2) global $post; $args = array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ); $x = get_children( $args ); if( ! … Read more
Download and install a full copy of WordPress to a sub-directory on your site. Having it in a sub-directory won’t interfere with any of your static pages in the root directory, or elsewhere on the site. The sub-directory for WordPress can be named whatever you like; you don’t have to name it /blog.
Like the front-end in WordPress, the admin pages have various css classes added to the <body> tag. You could use: body.post_type-page .fun-stuff-here { color:aqua; } Keep your action the same – the CSS will be loaded everywhere on admin, but only becomes relevant in the Pages section. (There’s a post_type-… for each.)