Support » Plugin: Relevanssi - A Better Search » Bookmarks?

  • Resolved brasofilo

    (@brasofilo)


    all right,
    there’s no support for bookmarks (although that would be nice)

    but, what if i do a template page that prints wp_list_bookmarks

    why can’t Relevanssi register that page?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Relevanssi doesn’t work on page template level. Relevanssi reads only the page content from the WordPress database and expands short codes, if necessary. Relevanssi doesn’t care about the templates used to display pages.

    for what you say, printing my blogroll in a page with a shortcode should index my bookmarks…

    but it ain’t working
    curiously, when i hit “Build the Index”, the shortcode gets printed inside the plugin page!

    this is what i used:

    function printBookmarks( $atts, $content = null ) {
    	wp_list_bookmarks();
    }
    add_shortcode('myblogroll', 'printBookmarks');

    my bad,
    the correct and working code for Relevanssi to grab the content of a dynamic blogroll page is:

    function printBookmarks( $atts, $content = null ) {
    	$ritorna = "";
    	$taxonomy = 'link_category';
    	$args ='';
    	$terms = get_terms( $taxonomy, $args );
    	if ($terms) {
    		foreach($terms as $term) {
    			if ($term->count > 0) {
    				$ritorna .= "<h3>".$term->name."</h3>";
    				$bookmarks = get_bookmarks( array(
    								'orderby'        => 'name',
    								'order'          => 'ASC',
    								'category_name' => $term->name
    				                          ));
    				foreach ( $bookmarks as $bm ) {
    				 		$ritorna .= sprintf( '<a class="relatedlink" href="%s">%s</a><br />', $bm->link_url, __($bm->link_name) );
    				}
    			}
    	 	}
    	}
    	echo $ritorna;
    }
    add_shortcode('myblogroll', 'printBookmarks');

    then just add the shortcode [myblogroll] inside a page and we’re good to go
    – and it’s much better than going through the hassle of doing a template page

    ps: thanks and kudos for this great plugin, msaari :o)

    Plugin Author Mikko Saari

    (@msaari)

    Thanks!

    Yeah, I’ve very rarely bothered with doing page templates, when using a shortcode is often much easier.

    just in case… full function here: http://pastebin.com/wk0fFFzT

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bookmarks?’ is closed to new replies.