Include Posts In Pages

Include Posts In Pages

Provides three functions that allows a theme to include associated posts and pages within a page.

It also provides other functions that support the inclusion of posts within pages

Theme functions

function get_all_main_posts_and_pages($pid, $args, &$selected_main_posts, &$current_main_posts)

Returns a WP_Query pointing to a list of standard posts that are a combination of:

  • posts that have this page as a parent
  • posts that have been selected for display on this page
  • posts which have a category identical to the pages slug/identifier.  This allows posts to be selected to be shown on common news pages or events pages

function get_all_side_posts($pid,$args,&$selected_side_posts,&$current_side_posts)

Returns a WP_Query pointing to a list of posts of type associated with the side of the page that are a combination of:

  • posts that have this page as a parent
  • posts that have been selected for display on this page

function get_page_summaries($pid,$args,&$selected_pages)

Returns a WP_Query pointing to a list of pages that have been selected to be listed on the page, e.g. as within a page that lists page excerpts.

 

The arguments are:

  • $pid: The current page ID
  • $args: Arguments that will be used within the wq_query.  Can be used to order or select further subsets of pages and posts.
$p_status = VisiblePostStatuses();
 $args = array( 'order' => 'ASC', 'orderby' => 'menu_order','post_status' => $p_status);
  • $selected_…: Returns a list of the posts or pages that have been explicitly selected
  • $current_…: Returns the complete lists of selected pages.  Also includes posts/pages included because they are children or have a category match

Support Functions

  • An anchor is automatically inserted into the top of the post so that it can be linked to within the page using the anchor
  • If the post has been inserted into a page (ie has a page as a parent) then the URL that is provided by wordpress for a post is converted to point to the anchor for the post within the page that it sits.
  • Any title at the top of the page is converted into a hotlink that points to the page where the post is located. .

Download plugin: include-posts-in-pages


Notice: Undefined index: edit_posts in /home/coherent/thedyers.org.uk/wp-content/plugins/allow-page-authors/allow-page-authors.php on line 389