Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter djenk

    (@djenk)

    To be more specific, I think the question is:

    How do I use custom actions and filters to make the post description link to the post? I see there’s a standard filter for wpc_item_description, but I haven’t been successful with the code I’ve added to my functions.php file.

    Thanks.

    Thread Starter djenk

    (@djenk)

    OK, so I mostly have this figured out using the code below, but I can’t get $params[‘post_url’] to print the url:

    function my_wpc_item_description( $description, $params ) {
    			$description .= '<a href="'. $params['post_url'] .'" title="'. $params['post']->post_title .'">'. $params['post']->post_excerpt .'</a>';
    	return $description;
    }
    add_filter('wpc_item_description', 'my_wpc_item_description', 1, 2);
    Thread Starter djenk

    (@djenk)

    Never mind. Got it to work with this:

    function my_wpc_item_description( $description, $params ) {
    			$description .= '<a href="'. get_permalink() .'" title="'. $params['post']->post_title .'">'. $params['post']->post_excerpt .'</a>';
    	return $description;
    }
    add_filter('wpc_item_description', 'my_wpc_item_description', 1, 2);

    Sorry for working this out in public, but maybe it’ll help someone else in the future.

    Plugin Author teastudio.pl

    (@teastudiopl)

    I’m glad you were able to solve this issue 😉

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

The topic ‘Template creation, editing’ is closed to new replies.