Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I´d like to override $title = get_bloginfo(); with --> $title = get_bloginfo('siteurl');

Some code from the plugin "Really simple Facebook Twitter share buttons":

function really_simple_share ($content, $filter, $link='', $title='', $author='') {
    static $last_execution = '';

    ...

    $custom_field_disable = get_post_custom_values('really_simple_share_disable');
    if ($custom_field_disable[0]=='yes' and $filter!='shortcode') {
        return $content;
    }

    //GET ARRAY OF STORED VALUES
    global $really_simple_share_option;
    $option = $really_simple_share_option;

    ...

    $first_shown = false; // NO PADDING FOR THE FIRST BUTTON

    // IF LINK AND TITLE ARE NOT SET, USE DEFAULT FUNCTIONS
    if ($link=='' and $title=='') {
        $link = ($option['use_shortlink']) ? wp_get_shortlink() : get_permalink();

        $title = get_bloginfo(); // OVERRIDE

        $author = get_the_author_meta('nickname');
    }

Can I do this in my functions.php because I´ll updating this plugin without changing this lines after every update.

Thanks

share|improve this question
    
May I ask why you want the title to be the site URL? –  TheDeadMedic Jul 10 '12 at 13:04
    
@TheDeadMedic: I´ll use this custom title as description in a pinterest post. –  ogni Jul 10 '12 at 13:37
1  
Just checked out the full plugin source - can't see a reliable filter/action to depend on. I suggest you contact the author & encourage them to add plugin-specific hooks. –  TheDeadMedic Jul 10 '12 at 13:41
add comment

1 Answer

It is possible to filter the get_bloginfo(), but you'll have to find a way to fine tune the conditional, because the override is global...

add_filter( 'pre_option_blogname', 'wpse_58030_override_blogname' );

function wpse_58030_override_blogname( $bool )
{
    // If not page with ID == 28, do nothing
    if( !is_page( 28 )  ) 
        return false;

    // Change the 'blogname'
    return "Not The Blog Name";
}

enter image description here

Observation

get_bloginfo() is the same as get_bloginfo('blogname').

If the desired filter was siteurl, the filter would be pre_option_siteurl.

share|improve this answer
    
This works great. THANKS. I´d like to override: '$title = get_the_title();' with '$title = get_bloginfo('siteurl');' Does it work, too? –  ogni Jul 11 '12 at 10:31
    
That depends on how the function really_simple_share is being called... –  brasofilo Jul 11 '12 at 10:38
    
Thanks. I share the whole PHP-Script: dropbox.com/s/j4912qn8yhpxkmn/… // LINE 219 –  ogni Jul 11 '12 at 11:07
    
Damn, that's an awesome filter I was never aware of. Thanks, @brasofilo! +1 –  Johannes Pille Oct 8 '12 at 1:47
    
@JohannesPille : Hook Hunters is the name of the movie :) –  brasofilo Oct 18 '12 at 4:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.