ThemeShaper Forums » Thematic

[closed]

Good Form for Posting Widgets?

(5 posts)
  • Started 8 years ago by soupking
  • Latest reply from soupking
  • This topic is not resolved
  1. soupking
    Member

    Hey there,

    I'm beginning the process of getting used to pre-defined PHP functions and what I make up on my own.

    I've managed to figure out how to post basic content into a DIV of my own creation. However, this brings me to a bit of a crossroads:

    1) Are most self-defined DIV tags and widgets placed/built in the functions.php? Or, going forward, is a there a more suitable way of organizing content in my child theme?

    2) I found the API for WordPress hooks: http://codex.wordpress.org/Plugin_API. I was wondering if that is the only API that Thematic uses or do theme developers begin their own range of page "dynamics"?

    Just trying to sort things out left and right as far as what I'm building, what's been built and can be connected, and where to build appropriately.

    Thanks for reading, open to any info as always.

    Posted 8 years ago #
  2. 1. yes, mostly. they could also go in page templates. you can also override templates like page.php and category.php if you really need too, but i have only needed to do this with page.php once or twice.

    here is what i do when functions.php starts to get super long:
    http://forums.themeshaper.com/topic/how-to-keep-organized-when-functionsphp-gets-uber-long

    2. thematic takes advantage of the WP hooks and creates ton more of its own to give you more modular control. i don't especially follow what you mean by page "dynamics"

    Posted 8 years ago #
  3. soupking
    Member

    1. cool, so I can treat any PHP page like the functions.php. Cool, great to know.

    2. Okay, so the whole idea is that these hooks are for the most part a global recognized WordPress system/codex, and Thematic has taken that and added on to it. I guess a good example for my asking is I'm looking to post a widget of some kind, either search bar or 3rd party. I found this list of hooks:

    http://themeshaper.com/thematic/guide/?page_id=10

    But I don't see anything for search bars on Thematic's site. I have to search through my own code. Should I be asking for a Thematic hook API of some kind or go to WordPress's codex and expect that what I sample there will work automatically in Thematic?

    Does that question make sense?

    Posted 8 years ago #
  4. 1. not exactly. but b/c of hierarchy... any version of page.php in your child theme's folder will supersede the version of page.php found in your parent (thematic) theme. you can certainly put PHP code here.. and HTML and really pretty much anything.

    2. again not exactly. WP has it's own set of hooks. Thematic has added its own layer on top of that- primarily through the templates (page.php, category.php, index.php, etc)

    if you are looking to add a widget, just go to the Widgets page in the dashboard and drop it into one of numerous widget areas. thematic already has a search widget. widgets are a perfect example of thematic interacting w/ WP functions to generate stuff.

    does that question make sense? maybe if i squint. i like to think of hooks as like pegs on a hat rack. you can then put whatever hat (function) on whatever peg (hook) you desire.

    for instance, there is a function called thematic_search_form() (defined in thematic/library/extensions/widget-extensions.php - all the guts of thematic are in the extensions folder!). you can display this function pretty much anywhere you care to by placing it on one of thematic's many hooks. if there wasn't already a function you could roll your own.

    //put thematic search above header
    add_action('thematic_aboveheader','thematic_search_form');
    
    //put custom function above sidebar
    function bacon(){
      //whatever is in this function will appear above sidebar
      echo "this is helga's classic bacon example";
    }
    add_action('thematic_abovemainasides','thematic_search_form');
    
    //adding a function to a hook always takes the same form
    add_action('thematic_hook_name','your_function_name');

    there is no thematic hook api at the moment. there is a wiki coming hopefully, but not yet. there is visual documentation of the available hooks at visualizing.thematic4you.com that i find quite helpful.

    most of what find at the WP codex will work with any theme. but you can't just blindly cut and paste what you find in the forums b/c you are using a child theme and so don't want to go willy-nilly hacking at the core thematic files. tho anything that says it is meant for the functions.php is pretty much game on.

    Posted 8 years ago #
  5. soupking
    Member

    1 & 2 - Cool, I understand that it's a bit of grey area between what is WP and what Thematic has done in addition to it. ALL THE GUTS OF THEMATIC ARE IN THE EXTENSIONS FOLDER. I'll try to drill that into my head.

    I think the routine or form (as I understand it) goes something like this:

    add_action('location of action', 'bacon function or widget');

    I'm getting warm right? That and many Thematic widgets are in extensions. If I import them from a 3rd party, I (or the admin) would most likely put the coding in extensions as well. If that's mostly the idea I'll practice and try trouble shooting this stuff.

    Thanks a bunch for helping me. It just really helps to have a semi-solid mindset before troubleshooting CSS.

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.