Displaying post/page info on a homepage using get_post()

I worked it out, when in the admin area of a page/post you can find the post ID in the browser URL: http://localhost/newsite/wp-admin/post.php?post=1807&action=edit So the previous dev simply uses this page as a ‘parent’, and refers to it as they set $id = get_post(1807); Now the query find posts/pages that a ‘children’ of this page.

Get post first paragraph without html tag [duplicate]

You can create function using wp_trim_excerpt to grab the first paragraph of text and ignore images function custom_excerpt($text, $raw_excerpt) { if( ! $raw_excerpt ) { $content = apply_filters( ‘the_content’, get_the_content() ); $text = substr( $content, 0, strpos( $content, ‘</p>’ ) + 4 ); } // strip any images on the code $text = preg_replace(“/<img[^>]+\>/i”, “”, … Read more

Show content from multiple pages (not posts) on home page

You can use the below query to get content from specific pages by id or page slug // WP_Query arguments $args = array( ‘page_id’ => ‘12,14,78,89’,//replace the page ids //’pagename’ => ‘aboutus, contact’, //or use page slugs ‘post_type’ => array( ‘page’ ), ‘post_status’ => array( ‘publish’ ), ‘posts_per_page’ => ’10’, ); // The Query $query … Read more