• While the excerpt title links to the correct post…
    www.mysite.com/article-1
    the ‘read more…’ is pointing to a category folder that does not exist
    and then it’s adding the category name
    www.mysite.com/category/news

    my shortcode in the news page is
    [catlist name=news numberposts=-1 content=no excerpt=yes excerpt_size=255 morelink="Continue reading..." morelink_class="continue" orderby=date order=DSC]

    Can’t figure out whatìs wrong….. any clue?

    thx

    http://wordpress.org/extend/plugins/list-category-posts/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter alby54

    (@alby54)

    OK, I might have misunderstood the purpose of the “morelink” shortcode, anyway, what I was after was the possibility of adding a “continue reading…” link at the bottom of the excerpt that could link to the full version of the post. The way the plugin is set, morelink links like this:
    ……/category/the category name. The way the link is set, is implemented into CatListDisplayer.php as follows:

    //Close wrapper tag
    		$this->lcp_output .= '</' . $tag . '>';
    		if (!empty($this->params['morelink'])):
    			$href = 'href="' . get_category_link($this->catlist->get_category_id()) . '"';

    I personally think there’s not much of a clever use for this feature so I changed the code to my needs:

    $this->lcp_output .= '</' . $tag . '>';
    		if (!empty($this->params['morelink'])):
    			$href = 'href="' . get_permalink($single->ID) . '"';
    		$class = "";
    		if (!empty($this->params['morelink_class'])):
    			$class = 'class="' . $this->params['morelink_class'] . '" ';
    		endif;
    		$readmore = $this->params['morelink'];
    		$this->lcp_output .= '<a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
    		endif;
    	}

    This way when I hit the “continue reading” link I get to the article and not to a category page which doesn’t even exist.

    Plugin Author Fernando Briano

    (@fernandobt)

    I might add something like this to the plugin, but the post’s title links to the post itself. Still, I can add it as a parameter in case you want a “read more” link for each post.

    Thread Starter alby54

    (@alby54)

    Yes the title links to the relative post. When I wrote the previous msg I didn’t check the script with more than one post and I didn’t realize that it wouldn’t have worked that way. I, anyway, managed to get what I was after.. by adding a template file in my child folder/ list-category-posts/customlist.php
    In the customlist.php I added as follows:

    <?php
    $lcp_display_output = '';
    $lcp_display_output .= '<ul class="lcp_catlist">';
    foreach ($this->catlist->get_categories_posts() as $single):
    $lcp_display_output .= '<li>';
    $lcp_display_output .= $this->get_post_title($single);
    $lcp_display_output .= $this->get_thumbnail($single);
    $lcp_display_output .= $this->get_excerpt($single, 'p', 'your p style');
    $lcp_display_output .= '<a class="continua" href="'.get_permalink($single->ID).'"><em>Continua a leggere...</em></a>';
    $lcp_display_output .= '</li>';
    endforeach;
    $lcp_display_output .= '</ul>';
    $this->lcp_output = $lcp_display_output;

    without the closing php code. So I was able to get a link to every single post and got some extra styling also.
    I added the template=customlist” into the shortcode and that did it.
    I still think that if you will provide an option like this directly from the shortcode.. it would be very nice.
    Thx a lot for your kind answer and for the great plugin.

    Thank you alby54 for your code. I was looking for it.
    Just a curious ques, how can i style it. I saw the ‘class’ attributes but didn’t understand how to implement. How can i show the title in a bigger font or in a different color. Thanks in advance.

    Edit: should i add the class In the style.css for my theme ?

    Thread Starter alby54

    (@alby54)

    You can modify the code and create a class for the title
    $lcp_display_output .= '<h2 class="entry-title">' . $this->get_post_title($single) . '</h2>';
    In this example you will need to style h2.entry-title with the attributes you want and that’s something you can add into your theme css sheet. Same thing can be done with paragraph, thumbnail and “more…”

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘morelink heads to a wrong url’ is closed to new replies.