Articles of get page

get_pages and number – no output; no errors;

I am attempting to get 3 pages from the parent page (id is 2035). I am using wordpress 3.2.1. Here’s my relevant code: <div id=”videos” class=”contentLeft”> <?php // get the three most recent videos (2035 is the video page) $recentVideos = get_pages(‘child_of=2035&number=3’); foreach ($recentVideos as $video) : ?> <div class=”video”> <h5 class=”video-title”><?php echo $video->post_title; ?></h5> […]

How to limit the characters shown on the page – get_content

I’ve the below php to display the content of the post id#9 on my ‘home page’ of my site, so that whenever the client updates the page, it’s reflected on the homepage as well – rather than having to make the change twice. At the moment all the post content is being shown, I need […]

Apply class to every third list item?

Possible Duplicate: How to mark every 3rd post I’m trying to give a class to every third list item on my page. I know how to give a class to every item, but not to specific items in a row, or in my case – the third. This is the code I am using: <?php […]

get_pages — parent vs child_of?

I’m working with get_pages on a site that has a very clean and hierarchical structure. As part of a template, I wanted to show child pages as part of the template’s ‘boilerplate’. Reading the Codex documentation, there are two parameters that seem relevant: parent and child_of. I’ve been fiddling with them using a simple dump […]

How to get ID of the page included with get_page()?

I’m rewriting the question, including exemplary code, I hope it will be easier to understand now. 1. My shortcode: function testid_shortcode( ) { global $post; return $post->ID; } add_shortcode(‘testid’, ‘testid_shortcode’); 2. The issue: I’m using the shortcode on page Example1 [ID=1]: [testid] Then I’m including it on different page Example 2 [ID=2]: $included_page = get_page( […]

Why is get_pages() returning a boolean?

I have created a custom post type that I want to use to allow people to add an arbitrary number of sections to the homepage of my theme. I want to loop through all posts of that type and include their contents in the page. My problem is that calling get_pages() with ‘post_type’ => ‘home_section’ […]

User Selectable Delete of Pages

in my WP MultiUser project i am designing a template for deleting a page from the front-end (only the super admin can access the back-end admin panel) I have almost achieved the desired result, but when I press “Delete,” the function deletes all pages. I just want to delete only the selected page. Here is […]

get_pages() as per custom menu order

I’m working on Single Page WordPress Theme where I want to get_pages() as per custom menu order. I have gone through the reference for get_pages() which only allows for default menu : get_pages(‘sort_order=asc&sort_column=menu_order’); Is there any way to get_pages() as per custom menu order ?

Get page content and execute shortcodes on a page

I would like to get show multiple page’s content on one page with shortcodes. If I use return $html; the shortcodes not working, if I use return do_shortcode($html); the shortcode working, but the content of the page dissapear. What is the working solution? function get_page_func( $atts ){ extract(shortcode_atts( array( ‘title’ => ” ), $atts ) […]

Getting post content within wp_nav_walker

I have a custom walker set up designed to add content into the nav menu. The problem being that it is not pulling the content. The post object returned by the get_post/get_page has an empty post_content attribute. What is causing this? Walker: class mobile_walker_nav_menu extends Walker_Nav_Menu { function start_lvl( &$output, $depth ) { // depth […]