Support » Plugin: List category posts » display_id=yes not showing ID in preview

  • Resolved fiestoforo

    (@fiestoforo)


    Hi, Im trying to obtain a list of Ids of my published posts, but the code (display_id) doesn’t seems to be working:

    [catlist name=z author=yes numberposts=-1 orderby=ID order=asc display_id=yes]

    This just retrieves title and author, but no ID, as it used to do.

    • This topic was modified 3 months, 2 weeks ago by fiestoforo.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    Thanks for reporting, it’s already being fixed.

    platinumshore

    (@platinumshore)

    Sadly as of the current version 0.83.1 of the plugin, display_id=yes still does not work – if it’s intention is to add a post id to each post link ? It sadly does nothing.

    eg

    [catlist id=3 conditional_title=”Our standard services” conditional_title_class=”cat_click_3″ class=”posts_section_3″ display_id=yes]

    and a resultant

    • link looks like

      <li><a href="" title="Asset planning">Asset planning</a></li> – notice no id.

      Hopefully gets fixed soon.. seeing if I can fix the code myself in the meantime.

      By the way is it possible to add a class to each post anchor tag aswell ? got to try to use Jquery event handlers for ajax feeding of links, and would be useful.

      Cheers.

    platinumshore

    (@platinumshore)

    I founded the bug in the file lcp-catlist.php

    The public function get_display_id never returned anything, so I modified it as..

    ` public function get_display_id($single) {
    $lcp_display_output=””;
    if (!empty($this->params[‘display_id’]) && $this->params[‘display_id’] == ‘yes’){
    $lcp_display_output = $single->ID;
    }
    return $lcp_display_output;
    }`

    Now returns the display id – I made some other optional custom modifications in function get_post_link() in file lcp-catlistdisplayer.php to add any return post id as an attribute in the anchor link.. eg

        if($this->get_display_id($single)=="") {
    
        $info = '<a href="' . get_permalink($single->ID) . '" title="' . wptexturize($single->post_title) . '"';
    
        } else {
    
        $info = '<a href="' . get_permalink($single->ID) . '" post_id="'.$single->ID.'" title="' . wptexturize($single->post_title) . '"';
    
        }

    also changed display.php template to not add post id to the end of the anchor link – as the post_id i feel would be more useful in the post anchor tag links as a data attribute for say event handlers post_id..

    Plugin Contributor zymeth25

    (@zymeth25)

    As of my previous writing this was fixed in the development version over a month ago but still has not been pushed to WP repository. We will release a new version as soon as we can.

    Plugin Contributor zymeth25

    (@zymeth25)

    By the way is it possible to add a class to each post anchor tag aswell ? got to try to use Jquery event handlers for ajax feeding of links, and would be useful.

    It is possible, ready the documentation to find out how.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.