Support » Fixing WordPress » Help Me Learn About Functions and Filters

  • bennygill

    (@bennygill)


    Hey,

    So I’m getting to the point where I should learn how to do some of this stuff myself instead of asking on forums every couple of days.

    I was hoping someone could show me an example using my current problem of how to make a filter (think that’s what they’re called) in my functions file. That way when I find some more stuff I want to ‘filter’ in the future I wont have to annoy you guys again 😉

    So…..

    In a file named ‘skematik-header-functions.php’ I have this bit of code I want to filter out:

    bloginfo( 'name' );

    I thought I should be making some kind of filter in my functions.php file to filter out the code – but I could be wrong. Also I’m using a child theme so it won’t be lost when I update. I’ve got the child theme thing sorted, just not sure how to make that filter.

    How would I do that?

Viewing 6 replies - 1 through 6 (of 6 total)
  • bennygill

    (@bennygill)

    Am I approaching this thing all wrong? Would that be the best way to do it… search for a function, and then create a filter in my functions.php file?

    Michael

    (@alchymyth)

    Forum Moderator

    I have this bit of code I want to filter out:

    bloginfo( 'name' );

    can you post the code in its context?
    possibly just paste the full ‘skematik-header-functions.php’ into a pastebin and post the link to it here – http://codex.wordpress.org/Forum_Welcome#Posting_Code

    http://codex.wordpress.org/Function_Reference/bloginfo
    http://codex.wordpress.org/Function_Reference/get_bloginfo

    what do you actually want to achieve?

    what theme are you working with?

    bennygill

    (@bennygill)

    Hey, thanks for the help.

    I’m working with the Skematik theme. I would as the developer – but support is very hard to come by.

    If I have WordPress SEO plugin active, my site has double site heading. It repeats the site name twice in all my page titles. So to fix that I removed the bloginfo( 'name' ); bit of code from my header by commenting it out (put // in front of it). And that code is found in the ‘skematik-header-functions.php’ file.

    But when I update my theme I loose that.

    I created a child theme to stop things like that happening. And I’m under the impression that I can make changes to my functions file in the child theme and it stays up to date even when I update the skematik frame work.

    So I want to know how to put something in my child theme functions file of how to ‘filter’ out that bit of code.

    Here is a pastebin of the entire skematik-header-functions.php file: http://pastebin.com/EUUgMR6g

    Sorry it’s late here and I’m tired… hope that makes more sense.

    Michael

    (@alchymyth)

    Forum Moderator

    from that file:

    DEVELOPERS CAN REMOVE ANYTHING HERE WITH A SIMPLE
    'remove_action' CALL.

    http://codex.wordpress.org/Function_Reference/remove_action

    – for details you need to contact the theme’s developers;

    commercial themes are not supported by this forum.

    bennygill

    (@bennygill)

    I’m not a developer and don’t entirely understand functions so the part I need help with is $tag and $function_to_remove (don’t think I’ll need $priority and $accepted_args right?).

    I’ve tried all different combinations in my functions file like:

    remove_action(‘skematik_header’,’bloginfo’);
    remove_action(‘skematik_header’,’name’);
    remove_action(‘skematik_header’,’skematik_doc_title’);
    remove_action(‘bloginfo’,’name’);
    remove_action(‘skematik_doc_title’,’bloginfo’);
    remove_action(‘skematik_doc_title’,’name’);

    …but none have worked.

    I’m trying to learn this better so I can apply it to other things later on without having to annoy you guys forum again and again 😉

    The support for the premium theme is very lacking so that’s why I’m asking in here. Any help is very much appreciated.

    bennygill

    (@bennygill)

    Could anyone show me what is the correct remove_action for this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help Me Learn About Functions and Filters’ is closed to new replies.