Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   Post Info Items and new plugins (http://forum.bytesforall.com/showthread.php?t=127)

technstuff Jan 27, 2009 07:21 PM

Post Info Items and new plugins
 
I wanted to add some new options to the Post Info Items. An example would be this Share This

I have figured this much out
1. bfa_postinfo.php is where the code for the plugin and the %example% are coded. I noticed that is not the normal <php> that must plugins in use. I tried to code a plugin and failed :p
2. bfa_theme_options.php is where the description is held.

Any help would be greatly appreciated and when I finish the hacks I will post the code so you can expand your list of integrated plugins.

Flynn Jan 28, 2009 02:32 AM

You're right, but you'd need a plugin template tag that does not print output, something like

PHP Code:

sharethis('echo=0'); 

A quick look revealed that share this may not have this. In that case you could try, in bfa_postinfo.php


PHP Code:

if (strpos($postinfo_string,'%share-this')!==false) {
######## SHARE THIS ########
if (function_exists('akst_share_link')) {
ob_start();
SHARE_THIS_TEMPLATE_TAGE_HERE
$share_this 
ob_get_contents();
ob_end_clean();
} else { 
$share_this ""; }


Then you should have the share this output inside $share_this and could, still in bfa_postinfo.php, (at the bottom where all the other replacements happen):

PHP Code:

$postinfo str_replace("%share-this%"$share_this$postinfo); 

And then add it as option to bfa_theme_options.php

I have not tried this. If you want to try this, please let me know if it worked.

holyyakker Feb 22, 2009 11:37 AM

I've been looking at this and not quite clear exactly where you are suggesting I insert the additional code - could you clarify perhaps? I'd love to use this as Share This is a more powerful tool (in my opinion) than sociable.

To clarify, I can't find postinfo.php anywhere.

Flynn Feb 22, 2009 11:59 AM

Quote:

Originally Posted by holyyakker (Post 1929)
I've been looking at this and not quite clear exactly where you are suggesting I insert the additional code - could you clarify perhaps? I'd love to use this as Share This is a more powerful tool (in my opinion) than sociable.

To clarify, I can't find postinfo.php anywhere.

Sorry and thanks for finding this. It should have been bfa_postinfo.php located at functions/bfa_postinfo.php

It's fixed now in the post above

The reason I chose Sociable is that Share This requires using an offsite service if memory serves right

holyyakker Feb 22, 2009 12:02 PM

Further clarification - found what I should edit, tried the above code - didn't work.
Here is what I tried exactly:
Code:

if (strpos($postinfo_string,'%share-this')!==false) {
######## SHARE THIS ########
if (function_exists('akst_share_link')) {
ob_start();
if (function_exists('sharethis_button')) { sharethis_button(); }
$share_this = ob_get_contents();
ob_end_clean();
} else { $share_this = ""; }
}

I have also tried this:
Code:

if (strpos($postinfo_string,'%share-this')!==false) {
######## SHARE THIS ########
if (function_exists('sharethis_button')) {
$share_this = sharethis_button();}
}

With this at the bottom:
Code:

$postinfo = str_replace("%share-this%", $share_this, $postinfo);
For clarification - this is the Share-This template tag:
Code:

<?php if (function_exists('sharethis_button')) { sharethis_button(); } ?>
I'm sure there is something simple I'm missing?

Flynn Feb 22, 2009 03:11 PM

After you did the code additions in bfa_postinfo.php as described in post #2, you'd have to add %share-this% to one of the textareas at Atahualpa Theme Options -> Post/Page Info Items

holyyakker Feb 22, 2009 04:29 PM

I'm sorry Flynn - I should have mentioned I did include the %share-this% to no avail. I'm going to go back and try again to see if perhaps I missed something.

Tried again in multiple combinations - still no dice.

Flynn Feb 22, 2009 06:11 PM

Plus the share this plugin needs to be installed (=uploaded) and activated

holyyakker Feb 26, 2009 07:04 PM

Oh I definitely have Share this uploaded and activated - I still am not having any success. I'm sorry for being such a pain. I think I don't understand the code enough to see what I should be doing - this is a bit beyond my novice php abilities. :)

holyyakker Feb 26, 2009 07:30 PM

I AM A GOD AMONG MEN!

.... okay, not really.

But I did fix the problem and it's so stupid I'm going to beat myself for a few hours now.

PHP Code:

if (strpos($postinfo_string,'%share-this')!==false) {
######## SHARE THIS ########
if (function_exists('sharethis_button')) {
ob_start();
sharethis_button();
$share_this ob_get_contents();
ob_end_clean();
} else { 
$share_this ""; }


This code at the bottom was 100% right.

PHP Code:

$postinfo str_replace("%share-this%"$share_this$postinfo); 



All times are GMT -6. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.