ThemeShaper Forums » Thematic

[closed]

How to access a widget area ?

(6 posts)
  • Started 3 years ago by lstelie
  • Latest reply from helgatheviking
  • This topic is resolved
  1. Hello

    I use WP 3.3b4 and THEMATIC SVN

    I'd like to replace index_top and single_top widget zones byt a hook or a filter (I'd like to place instead a nivo-slider content)

    how can I proceed ?

    Thanks in advance

    Luc

    Posted 3 years ago #
  2. uhh... i don't understand exactly what you are trying to do. nothing shows up in either of those widget areas if they don't have any active widgets therein.

    start by reading this post on widgets
    themeshaper.com/forums/topic/something-new-bout-widgetized-areas

    if you just want to add nivo slider content in that area you just add the content to the same hook. you could unset those particular widgets as well if you so desired.

    Posted 3 years ago #
  3. Hello,

    The context :
    My original website (carrington based) : http://velofun.fr
    My playground to learn Thematic : http://www.saint-elie.com/testbed
    WP 3.3b4 / Thematic latest svn
    I’m not a developper (even not a designer, just a long time wp user who try to learn how to have a WP site that behave exactly as I want)
    English is not my mothertongue so the way I express myself can be.. original

    What I try to do

    I try to replace index-top (a widget zone) content by a hard coded content (a nivo-slider but it could be anything else, a picture, a googleads code …..)

    In fact I try to learn how to replace the content of a widget by something else defined by my code , keeping the widget css-tagging and formatting

    Solution I see so far

    1) Manual, hardcoded way :
    - make a view source of the code output by Thematic,
    - copy the html/css code corresponding to the index-top zone,
    - make a copy of index.php in my child theme folder
    - replace `// calling the widget area 'index-top'
    get_sidebar('index-top');`
    by the copied code.
    - edit by hand the html-css-whatever content inside the widgetcontainer widget_text

    2) More elegant way :
    Write a function if this is possible that filters the widget content and replace it by my own content (in this case the nivo-slider code)

    My problem/search
    The first solution works (that’s normal is the basic parent/child behavior)
    The goal of what I do is to learn and understand.. and I’m looking for the way to do this the second way (programmatically)

    The messages thread you gave me is a little bit complex for me (I’m not a developer) and above all it seems to be about display or not display a widget.

    I wand my widget index-top to display normally, what I want is to control it’s content.

    Thanks for your time

    Luc

    Posted 3 years ago #
  4. Luc,

    Now that is exactly how i wish everyone who is asking for help would write their posts. :) Tell me what you want, what you have tried and why it isn't working the way you'd like. That is practically support request heaven and makes my job of helping you much simpler.

    I have a much clearer picture of what you are trying to do. However, I still hold that my earlier suggestion is the best approach.

    To further explain what I am suggesting:

    1. there is no need to replace get_sidebar('index-top'); with anything
    if there is no active widget in this area then nothing will ever display in this location, unless you attach content to the hook widget_area_index_top() which conveniently happens to be located inside the index-top sidebar

    try this:

    add_action('widget_area_index_top','kia_index_top');
    
    function kia_index_top(){
    	echo "helga likes bacon";
    }

    that should put some content in the index-top widget location.. which if you don't have widgets in that area really isn't any different from using the above_indexloop hook

    add_action('thematic_above_indexloop','kia_index_top');
    
    function kia_index_top(){
    	echo "helga likes bacon";
    }

    if you don't want this widget to even appear in the backend (so you can never place a widget in this area) you'd unset it from the thematic array... which is what i linked you too before, so like this:

    add_filter('thematic_widgetized_areas','kia_widgets');
    
    function kia_widgets($widgets){
    	unset($widgets['Index Top']);
    	return $widgets;
    }

    hope that helps. for more on understanding hooks and filters please see this other post that i wrote:

    http://forums.themeshaper.com/topic/need-help-understanding-actions-vs-filters-and-changing-post-meta-and-utility#post-22638

    Posted 3 years ago #
  5. Helga,

    I'm currently evaluating the idea to marry you.

    It's exactly what I was looking for, i missed the action -> widget_area_x

    it works like a charm

    Thanks a (huge) lot

    Luc

    Posted 3 years ago #
  6. LOL. glad it worked and hopefully you understand thematic a little better now.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.