• Resolved stl99

    (@stl99)


    Hi there,

    Any idea why content tags stopped working after the latest update?

    Here’s what we’re using inside a function:

    	<?php
    
    	$post_html = '<h3><a class=\'weekly-popular-list\' title=\'{text_title}\' href=\'{url}\'>{text_title}</a></h3>{thumb}{summary} <a href=\'{url}\'>More ?</a>';
    
    	ob_start();
    	wpp_get_mostpopular('range=last7days&freshness=1&limit=20&post_html="'.$post_html.'"&excerpt_length=80&excerpt_by_words=1&thumbnail_width=900&thumbnail_height=517');
    	$output = ob_get_clean();
    
    	$output = str_replace( 'class="wpp-thumbnail wpp_cached_thumb wpp_featured', 'class="alignleft post-image entry-image', $output );
    
    	$output = $title_html . $url_html . $intro_html . "\n" . $output;
    
    	echo '<pre id="selectable" style="border: 1px solid #eee; padding: 1em; overflow: auto;">' . htmlspecialchars( $output, ENT_NOQUOTES ) . '</pre>';

    Instead of rendering the posts it displays the content tags inside HTML.

    Best,
    Thomas

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @stl99,

    Tested your code and it worked as expected (but you forgot to include $title_html, $url_html and $intro_html :P).

    That <pre> tag you’re using though is preventing WordPress Popular Posts from loading your posts. If you do echo $output; it’ll work.

    Thread Starter stl99

    (@stl99)

    Too bad, until now it has been working fine. We used it to create HTML code for a post list to copy and insert into a post as a static list.

    Would it still be possible to get the HTML code instead the rendered WPP list? I’m not really sure what changed so that it doesn’t work anymore as before.

    Plugin Author Hector Cabrera

    (@hcabrera)

    If what you’re seeing is similar to this:

    <div class="wpp-shortcode"><script type="application/json">{"title":"","limit":"20","offset":0,"range":"last7days","time_quantity":24,"time_unit":"hour","freshness":false,"order_by":"views","post_type":"post","pid":"","cat":"","taxonomy":"category","term_id":"","author":"","shorten_title":{"active":false,"length":0,"words":false},"post-excerpt":{"active":true,"length":"80","keep_format":false,"words":true},"thumbnail":{"active":true,"build":"manual","width":"900","height":"517"},"rating":false,"stats_tag":{"comment_count":false,"views":true,"author":false,"date":{"active":false,"format":"F j, Y"},"category":false,"taxonomy":{"active":false,"name":"category"}},"markup":{"custom_html":true,"wpp-start":"<ul class=\"wpp-list\">","wpp-end":"<\/ul>","title-start":"<h2>","title-end":"<\/h2>","post-html":"<h3><a class='weekly-popular-list' title='{text_title}' href='{url}'>{text_title}<\/a><\/h3>{thumb}{summary} <a href='{url}'>More \u00bb<\/a>"},"theme":{"name":""}}</script><div class="wpp-shortcode-placeholder"></div></div>

    … then it’s because the “Load popular posts list via AJAX” feature is set to Enabled (WP Dashboard > WordPress Popular Posts > Tools, under Data). Changing it to Disabled should give you the HTML output you want, however note that if you’re using a page caching plugin (eg. W3 Total Cache) your popular posts list will be cached by it as well.

    Thread Starter stl99

    (@stl99)

    Unfortunately, we’re using a caching plugin disabling Ajax is not an option.

    Any suggestion how to render a WPP list in pure HTML in order to copy and paste it somewhere else? That’s probably an edge case but maybe useful for others as well.

    The use case is to manually create a “Most Popular Posts of the Week” post in the needed HTML layout. The original function worked fine for that.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Any suggestion how to render a WPP list in pure HTML in order to copy and paste it somewhere else?

    For this particular scenario personally I’d use the WordPressPopularPosts\Query class to fetch popular posts data and then build the HTML output from scratch out of that.

    Thread Starter stl99

    (@stl99)

    Do you happen to offer custom services? I’d be interested in having our broken feature fixed or newly set up.

    Plugin Author Hector Cabrera

    (@hcabrera)

    I do, however I believe we’re not really allowed to talk about that here as per www.remarpro.com Forum Guidelines.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I do, however I believe we’re not really allowed to talk about that here as per www.remarpro.com Forum Guidelines.

    Good reply @hcabrera but that is a conversation you can take off of these forums if you like.

    Just provide a link such as a contact URL (again, only if you want to) and that conversation can happen there instead.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Oh, that makes things easier then. Thanks for the clarification, @jdembowski!

    @stl99 please feel free to reach out using my contact form and we’ll take it from there: https://cabrerahector.com/about/#say-hi

    Thread Starter stl99

    (@stl99)

    Message sent via contact form.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Content tags stopped working’ is closed to new replies.