• Resolved daymobrew

    (@daymobrew)


    After making use of the filter to control the shortcode output, I thought about an enhancement to allow people specify the list type.

    Currently it produces an unordered list. How about an ordered (numbered) list? How about no list at all (use divs)?

    I write some code to do this and pasted a patch to https://pastebin.com/jwT8EzNu
    The commented out $output line should be removed. I replaced it with a sprintf as I felt it was easier to read.

    I added a post counter and included this as an id e.g. post-2. I didn’t use a class because it could conflict with the class in the body tag.

    https://www.ads-software.com/extend/plugins/display-posts-shortcode/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter daymobrew

    (@daymobrew)

    Another thing, as I initialise the $container to ‘ul’ and $post_container to ‘li’ before checking $list_type, the ul/unordered/unordered_list/default parts of switch() aren’t needed. I put them in for completeness.

    Plugin Author Bill Erickson

    (@billerickson)

    While it’s definitely a useful feature, the plugin is more focused on querying posts than on display. I purposefully gave it a very simple display and then added the filter so that you could customize the presentation.

    But you bring up a good point. The filter I provided let’s you modify the markup of the individual posts but not their wrapper. How about I create another filter for the outer markup?

    Thread Starter daymobrew

    (@daymobrew)

    I think that filters are appropriate to developers and shortcode attributes for non-developers.

    To keep both camps handy you could provide both.

    This would be a great addition (IMO) as I would love to be able to stylize the posts as well as the wrapper! Currently I’d use just a div, but want some stylization…Orrr if I use some stylization everything gets indented as a list, which is undesirable in my application

    Thanks! Greattttt plugin!

    Plugin Author Bill Erickson

    (@billerickson)

    You can actually control this now using the ‘wrapper’ attribute.

    [display-posts wrapper="div"]

    That will use a div for the outer wrapper (around all posts) and divs around each individual posts.

    You can customize these further using the inner and outer output filters:

    display_posts_shortcode_output
    display_posts_shortcode_wrapper_open
    display_posts_shortcode_wrapper_close

    Thank’s for such a quick reply on this Bill! I kept tinkering last night trying different things here & there…and by the time I came across the output/open/close my eyes were burnt out. Are these also going in the shortcode or the css?

    ultimate goal is to have posts listed as a div, but still be able to stylize them, mainly to pad above & below.

    mucho thanks!

    Thread Starter daymobrew

    (@daymobrew)

    You can easily style the default (more modified) output by adding padding to the li (or div) elements.

    thanks for adding extra guidance daymobrew! I think I am confusing myself with adding the attributes to the shortcode or modifying the filters in the plugin. My end-goal (with just adding links to columns) is here: https://williambennettiv.com/ (used just for testing) The wrapper=div is just with the div, the “desired look” is how I’d ultimately like to style it so each post does not run into each other and I can right-justify rather than full.

    Plugin Author Bill Erickson

    (@billerickson)

    You’ll want to style the .listing-item in your style.css file. Something like this:

    .listing-item {
    padding-bottom: 10px;
    text-align: right;
    }

    ANDDDD BINGO! Needed another cup of coffee this morning clearly! Hadnt had it in my CSS so I wasnt looking for it!

    Thank you BOTH (Bill & Daymobrew) for awesome help – and thank you bill for a great plugin!

    Hey guys,
    Great stuff!

    My problem is that I am trying to get my text to align to the top – right next to my thumbnail image. Right now the excerpt text keeps going to the bottom of the thumbnail image.

    I tried to fix this with a CSS div but it just ignored my div code. I am using:

    [display-posts image_size=”thumbnail” category=”news” posts_per_page=”-1″ include_date=”true” include_excerpt=”true” wrapper=”div”]

    Thread Starter daymobrew

    (@daymobrew)

    Can you post a link to your site?

    Sorry not yet since it is just an IP address I am using for a client until we can port over their site. I am not allowed to post it for security reasons.

    I had to give up using this plugin and got it work instead using List Category Posts plugin

    Thread Starter daymobrew

    (@daymobrew)

    Can you post the code that is generated by this plugin?
    You can use https://pastebin.com

    I don’t think it would help since I also had to create and make changes to template.php file to get it to work

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: Display Posts Shortcode] Add option to use ordered list or no list’ is closed to new replies.