WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] Where is the "Further Customization" section? (2 posts)

  1. slobizman
    Member
    Posted 1 year ago #

    I keep seeing references to see the "Further Customizations" sections to learn how to filter the output. However, I cannot find such a section anywhere. Can someone point me to it?

    Note: What I'm trying to do is get the title on it's own line and wrap it in H2's.

    Thanks. Brilliant plugin and it's going to be a lifesaver.

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  2. slobizman
    Member
    Posted 1 year ago #

    I never found the Further Customizations section, but using the filtering example, I figured out out to wrap the title in H2's! For anyone that need this, add this filter to your functions.php:

    //----------------------------------------------------------
    // Display Posts Shortcode plugin: add H2 to title
    //----------------------------------------------------------
    add_filter( 'display_posts_shortcode_output', 'format_dps_title', 10, 7 );
    function format_dps_title( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper ) {
    
    	// Make Title and H2
    	$title = ' <h2>'. $title .'</h2>';
    
    	// Now let's rebuild the output.
    	$output = '<' . $inner_wrapper . ' class="listing-item">' . $image . $title . $date . $excerpt . '</' . $inner_wrapper . '>';
    
    	// Finally we'll return the modified output
    	return $output;
    }

    Then, if you have an excerpt following that, you'll see a dash at the beginning of it. To remove the dash, add this to your CSS:

    .display-posts-listing .excerpt-dash {
            display:none;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.