Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mukiri

    (@mukiri)

    OK, thanks, I almost get it.

    But help me out with the code.. how do I pass new values to $crp_settings? apply_filters maybe to the crp_default_options function?

    Thread Starter mukiri

    (@mukiri)

    Hello Hector,

    Finally updating my code, based on the update that now accepts arguments and this now appears to work just fine.

    Here is the code

    $popular_posts_args = array (
    			'header_start' => '<h2 class="widgettitle">',
    			'header' => 'Popular Episodes',
    			'header_end' => '</h2>',
    			'limit' => 5,
    			'range' => 'all',
    			'title_length' => 25,
    			'title_by_words ' => true,
    			'post_type' => 'post',
    			'cat' => '4',
    			'excerpt_length' => 20,
    			'thumbnail_width' => 100,
    			'thumbnail_height' => 80,
    			);
    
    		wpp_get_mostpopular($popular_posts_args);

    This works up until I try to pass in ‘markup’ parameter.

    $popular_posts_args = array (
    			'header_start' => '<h2 class="widgettitle">',
    			'header' => 'Popular Episodes',
    			'header_end' => '</h2>',
    			'limit' => 5,
    			'range' => 'all',
    			'title_length' => 25,
    			'title_by_words ' => true,
    			'post_type' => 'post',
    			'cat' => '4',
    			'excerpt_length' => 20,
    			'thumbnail_width' => 100,
    			'thumbnail_height' => 80,
    			'markup' => array(
    				'wpp-start' => '<ol class="wpp-list">',
    				'wpp-end' => '</ol>',
    				'title-start' => '<h2 class="widgettitle">',
    				'title-end' => '</h2>') ,
    			'post_html' => '
    					<li class="clearfix">
    						<div class="wpp-content">
    							<div class="wpp-img">{thumb}</div>
    							<div class="wpp-text">{title}
    								<p class="wpp-stats">{stats}</p>
    							</div>
    						</div>
    					</li>'
    			);

    The above code produces an error:

    ‘Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp\www\Tujuane_Draft\wp-content\plugins\wordpress-popular-posts\wordpress-popular-posts.php on line 3000’

    In addition, I note that one can only pass categories as cat_ids.

    Is it possible to create the option of passing in the category by its category-slug? Reason I ask this, is I am developing my theme locally, and sometimes I cannot be sure if the same cat-ids are assigned to the same categories when they are created on the live site..

    Thread Starter mukiri

    (@mukiri)

    OH!, I see what you did there!

    Thanks Hector,

    This workaround actually does work

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)