• _rg_

    (@arriba)


    Also as you will see, you could get anything adjusting this to your needs. This is not a threat really, i would only to share these functions:

    function instertContent($pagename){
    	$temp = $wp_query;
    	$wp_query = null;
    	$wp_query = new WP_Query();
    	$wp_query->query('pagename='.$pagename.'&static=true');
    	while ($wp_query->have_posts()) : $wp_query->the_post();
    		apply_filters('the_content', the_content());
    	endwhile;
    	$wp_query = null; $wp_query = $temp;
    	rewind_posts();
    }
    function instertExcerpt($pagename){
    	$temp = $wp_query;
    	$wp_query = null;
    	$wp_query = new WP_Query();
    	$wp_query->query('pagename='.$pagename.'&static=true');
    	while ($wp_query->have_posts()) : $wp_query->the_post();
    		apply_filters('the_excerpt', the_excerpt());
    	endwhile;
    	$wp_query = null; $wp_query = $temp;
    	rewind_posts();
    }

    Usage (both)

    $pagename = ‘this-is-an-original-nice-name’;
    instertContent($pagename)

    As you can see, here i´m getting only pages, because i use the “pagename” inside query, but you can use it anywhere and with anything, just change params.

    If you have subpages, you will know the nice-name passed must be the path to, like:

    $pagename = “this-is-the-main-page/this-is-the-one-i-want”;

    And that´s all, have fun.

  • The topic ‘the_content & the_excerpt anywhere…’ is closed to new replies.