Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Need template tag to show forum link in blog post
Avatar
Shawn S
Member
Free Members
sp_UserOfflineSmall Offline
Dec 31, 2011 - 8:58 am

I have a site in the development stages. It was running WP 3.3 and SP 4.5 and I decided to upgrade to SP 5. When I originally installed SP, I had some display problems in my theme (iThemes Builder) so I used the template tags to insert the forum links on the blog posts instead of the automatic function (the auto function causes forum links to show up in widget areas that shouldn't have them)

This is the code that worked in my theme in SP 4.5:

<?php global $post; 
sf_blog_linked_tag($post->ID, true); ?>

After upgrading to SP 5, the code now shows an error in my theme pages:

Fatal error: Call to undefined function sf_blog_linked_tag() in /problem-with-post-edit-buttonome/ninja/public_html/nbs/wp-content/themes/BuilderChild-Foundation-Blank/page.php on line 22

I'm guessing the template tag formats have changed for version 5 but after searching around the forum here, I haven't found any solutions. I do have the template tag plugin installed and activated. Does anyone know what code I should use to replace the original template tag for showing the forum link?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 31, 2011 - 11:28 am

Because Blog Linking is now a plugin and not a part of the core then any template tags associated with Linking are now a part of the Linking package. You will find it has it's own 'template tags' folder.

The one you want, I believe, is

spBlogTopicLinkTag($postid, $show_img);
andy-signature.png
YELLOW
SWORDFISH
Avatar
Shawn S
Member
Free Members
sp_UserOfflineSmall Offline
Dec 31, 2011 - 9:56 pm

Ok, I'm no php expert so it is quite possible I have messed up somewhere but I replaced my original template tag code with this:

<?php spBlogTopicLinkTag($postid, $show_img=true); ?>

 

and I get the following error:

Fatal error: Call to undefined function spblogtopiclinktag() in /problem-with-post-edit-buttonome/ninja/public_html/nbs/wp-content/themes/BuilderChild-Foundation-Blank/page.php on line 21

I looked in the new template tags folder but as I said I'm no php expert. I can get the links to show up using the automatic function but not manually. What am I doing wrong?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 31, 2011 - 10:17 pm

are you sure you replaced it exactly?  doesnt look like it...  the name is case sensitive...  ie you need the capital letters in the function Andy posted...

Avatar
Shawn S
Member
Free Members
sp_UserOfflineSmall Offline
Jan 1, 2012 - 8:59 am

Yes, I noticed that and thought it was strange so I double checked. The code I put in my template has the capital letters but the error code shows the lower case. Here is a copy and paste of the code as it exists in my page.php template:

                <!-- post content -->
                <div class="post-content">
                    <?php the_content(); ?>
                    <?php spBlogTopicLinkTag($postid, $show_img=true); ?>
                    <?php wp_link_pages( array( 'before' => '<p><strong>' . __( 'Pages:', 'it-l10n-Builder' ) . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number' ) ); ?>
                    
                </div>
            </div>
            <!-- end .post -->
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 1, 2012 - 10:15 am

weird... but looking a bit deeper, I think you actually want to call:

oh, couple things, first, you have to replace the arguments with yours... you still have the function prototype there... show $postid should be the id of the post... and either true or false for second argument...

but I also think thats the wrong function to call... I dont think that is exposed... you need to call the wrapper function:

spBlogTopicLink

so it should look likek

spBlogTopicLink($post->ID, true);

if within the wp loop... or false if you dont want the image...

Avatar
Shawn S
Member
Free Members
sp_UserOfflineSmall Offline
Jan 1, 2012 - 10:27 am

Thanks, I tried the last one you listed:

<?php spBlogTopicLink($post->ID, true); ?>

and now I get a different error, but it at least seems to recognize the spBlogTopicLink now. Not sure what sf_esc_int is though:

Fatal error: Call to undefined function sf_esc_int() in /problem-with-post-edit-buttonome/ninja/public_html/nbs/wp-content/sp-resources/forum-plugins/blog-linking/template-tags/sp-linking-blog-tags.php on line 26
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 1, 2012 - 10:31 am

argh...  thats a bug on our part... there are three of those in the blog linking plugin file referenced... if you could change them to:

sp_esc_int

it should work... I will fix them up and get them committed to svn...  should hopefully get an update out today...

Avatar
Shawn S
Member
Free Members
sp_UserOfflineSmall Offline
Jan 1, 2012 - 10:45 am

Ok, I made those three changes to the referenced file and now I get no errors but I also get no blog link displayed on my page.

 

Just to add additional information, I can turn on the option to "Create blog post to topic link automatically" and the link will show up perfectly. The reason this automatic option won't work for me is because it causes the links to also appear in my theme's "widget content" areas. This occurs despite having "widget_content" unchecked in the post types section listed under Post Linking.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 1, 2012 - 11:30 am

I am looking at it now. There are some other problems in there that we didn't find. Will come back to you.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 617
Members: 17359
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10125
Posts: 79620