Grow your CSS skills. Land your dream job.

wp_trim_excerpt?

  • # March 13, 2012 at 12:41 pm

    Hi all,

    I’m struggling with an issue about the excerpt. What i’ve got, is the following.

    I’ve got an id of a page. And i want that specific page to be displayed on a particular place. But i don’t want to show the full content of the post. I know what you’re thinking, use the_excerpt!!! But that won’t work in this case, so in my search i found the function wp_trim_excerpt(), and when you put some text into this function, it will give an excerpt of that text.

    Well that’s what the reference guide of WP says, but i don’t get the excerpt of the page, but the whole content.. Probably i’m using it one the wrong way. So, can someone give me a hand?

    This is the code:


    /* Get front-end block's */
    function yandt_content_block( $position ) {
    global $wpdb;
    $content = $wpdb->get_row( "SELECT * FROM wp_yandt_frontcontent_content
    WHERE
    name = '" . mysql_real_escape_string( $position ) . "'" );
    // Get the page by ID
    $ID = $content->content_id;
    $page = get_page( $ID );

    // Check the position
    $extraClass = '';
    if( $position == 'Midden' ) {
    $extraClass = 'middle-one';
    }

    // Build the block
    echo '';
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".