Firing page_publish where page is child page

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

How to Change the path of a child page?

$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

Display all posts/pages in a multiple selectbox

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>”; } ?>

Loading internal page

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

1st Level Page with No Children

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

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