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)
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