ThemeShaper Forums » Thematic

[closed]

Adding a DIV section to Sidebar?

(17 posts)
  • Started 8 years ago by soupking
  • Latest reply from Jonny Janiero
  • This topic is resolved

Tags:

  1. soupking
    Member

    Hi there,

    I just want to say I'm so thankful for ThemeShaper. This theme design and instruction is the only site using WordPress that makes any sense to me. THANK YOU!

    I understand that there is a primary and secondary widget area for the side bar. I'd like to have my search form stuck to the top, just under the menu bar. But I feel that is separate from where my widgets should be so naturally I want to create another DIV or widget area just for the search bar.

    Here's my site in progress for reference:
    http://axiom-media.com/work/fdb/

    I imagine that it's possible, but even with:

    <?php wp_page_menu('sort_column=menu_order') ?>

    or

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div><label class="screen-reader-text" for="s">Search for:</label>
    <input type="text" value="" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" />
    </div>
    </form>

    I'm just planting code to trigger functions. I have no idea how to refer to the <?php yadda yadda?> with CSS. So far I've just inserted < a > and <img> tags in the page.php and edit the CSS. However, this whole widget thought is a bit tricky.

    Would anybody please mind telling me what I'm supposed to do? I understand if nobody responds. I don't get any responses at WordPress.org. I'm just looking to place the search bar up in the far top right-hand corner of the page, but I need it in a div to connect it to a style class.

    Thanks for your time.

    Posted 8 years ago #
  2. hopefully you are using a child theme for thematic and not editing thematic core directly.

    what you have is a simple matter of adding code to one of thematic's action hooks. think of it like hanging a hat on a particular coat rack..

    http://visualizing.thematic4you.com/

    will help you see the hooks that are available. then you add things in the following manner

    function a_new_function(){
      echo "bacon";
    }
    add_action('name_of_action_hook','a_new_function');

    in place of the echo "bacon" line that i always like to use, you'd add the code you are looking to add.

    if you want your new div to line up with the sidebar you'll need to give it the same classes as the sidebar divs.... namely class="aside mainaside" . i'm not sure why you can't just add the search widget to the primary widget area?

    but using the above example and visualizing thematic, you can add stuff anywhere.

    Posted 8 years ago #
  3. soupking
    Member

    Yes, I lucked out finding the FAQ page right after I got started. I had to scrap my initial start, but glad to do it. This site is awesome. I want to tell anybody starting out in WordPress should start here.

    The fact that Ian points out to use Firebug is a Godsend. Without that I'd spend SO much more time locating tags.

    So, the echo "variable" part is where developers improvise their own content?

    I guess my big misunderstanding is CSS doesn't attach to PHP, it attaches to XHTML. So even if I create another widget, where do I tell/put XHTML and label it to connect back to my main style.css?

    That and if I had a function echoing "bacon" where should I put it? The main index file? A lot of the code examples are very random an sparse about where stuff should go.

    I'll keep reviewing your notes and plugging along. Thanks a bunch for the help! :)

    Posted 8 years ago #
  4. well we've got a wiki project in the works, b/c we know the docu isn't the clearest. but it isn't here yet. firebug IS a godsend... you can answer 90% of your CSS questions right there.

    you are obviously correct that CSS does not attach itself to php. but if you can echo out bacon you can echo out anything. in place of my favorite bacon example you could just as easily do:

    function a_new_function(){ ?>
      <div id="bacon">Wow Bacon is Here!</div>
    <?php }
    add_action('name_of_action_hook','a_new_function');

    presto change-o, new div.

    you'd put this and ALL your PHP code in your child's functions.php

    if you are unclear, this is my favorite tutorial on the subject of creating a thematic child theme:

    http://www.catswhocode.com/blog/wordpress-how-to-easily-create-a-thematic-child-theme

    Posted 8 years ago #
  5. elderberry
    Member

    Maybe this will help, I cobbled it together from some examples on this forum. I used it to create a widgetized area above #primary. Then you could just go into Widgets an put the search widget in your new widgetized area.

    // Register Pre-Primary Widget Area
    
    function add_pre_primary_widget(){
        register_sidebar(array(
           	'name' => 'Pre Primary',
           	'id' => 'pre-primary',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "</li>",
    	'before_title' => thematic_before_title(),
    	'after_title' => thematic_after_title(),
        ));
    }
    add_action('init','add_pre_primary_widget');
    
    // Output Pre-Primary Widget Area
    
    function output_pre_primary(){
    	if ( is_sidebar_active('pre-primary') ) { // there are active widgets for this aside
            echo '<div id="pre-primary" class="aside sub-aside">'. "\n" . '<ul class="xoxo">' . "\n";
            dynamic_sidebar('pre-primary');
            echo '</ul>' . "\n" . '</div><!-- #pre-primary .aside -->'. "\n";
    	do_action('widget_area_pre_primary');
    	}
    }
    add_action('thematic_abovemainasides', 'output_pre_primary');
    Posted 8 years ago #
  6. soupking
    Member

    Ooookay, I think I'm starting to get this.

    You can actually put full chunks of HTML tagging in PHP functions? Sweet.

    Okay, that helps a bunch cuz all the PHP coding you see in Thematic is all just PHP variables and conditions etc. At least for the most part, I didn't see anything other than concatenated inline <? HTML ?> which doesn't make any sense unless you "get it", you know?

    So where should I put all these new functions? Just in the main index and then call the functions where I'd like them to be positioned in the body?

    @helgatheviking - thanks for this too: http://visualizing.thematic4you.com/ Really helps map out the theme. I think anybody who makes a theme should make a blueprint like this. It's only good form.

    @elderberry - Thanks for the code snippets. I'll probably re-visit once I'm past the elementary stage if I indeed understand what's going on. Via the visualization I'll probably put my pre-widget content in thematic_abovemainasides(). I think that's where it should go.

    THANKS AGAIN YOU GUYS!!! TOTAL AWESOMENESS!!!

    Posted 8 years ago #
  7. soupking
    Member

    Oops, I know where to put the functions. Sorry, read the post again. I'm a terrible reader, too used to scanning code.

    Huge Thanks Again!

    Posted 8 years ago #
  8. thematic_abovemainasides is exactly where you should put your content. i can't see why you'd need another widget area above primary- you'd just throw your widget into primary, you know?

    "So where should I put all these new functions? Just in the main index and then call the functions where I'd like them to be positioned in the body "

    please see this tutorial:
    www.catswhocode.com/blog/wordpress-how-to-easily-create-a-thematic-child-theme

    you need to set up a child theme and then all these functions will go in your child's functions.php file. sorry if you already knew that, but i see it all the time on here that people start hacking at the thematic core which negates the point of child theming (namely that you're safe from upgrades and you don't lose your code)

    Posted 8 years ago #
  9. soupking
    Member

    Awesome! Wait, super cool! Wait!

    Exactly.

    I'm so on board. I so get it get it get it. I can see why people would hack it this stuff for hours and not...get it. I'm just thankful you would help me. I hate to sound like a jerk but WordPress.org did zip for me. The whole site felt like.."Well, duh stupid. Look at the codex." (which makes no sense if you don't understand WordPress!)

    Thematic is awesome and you guys are great. I do think WordPress org and com are great as well. I just think it's important that people stay inspired and unafraid.

    Again, you rock! So does Ian Stewart for putting together such a great resource. I'd be on a dingy in the sea without this site. Honest.

    Best wishes!
    -soupking

    ps ...I'm sure I'll be back with more inane questions regarding plugins. :P

    Posted 8 years ago #
  10. elderberry
    Member

    @helgatheviking - I added a widget area above #primary because the site layout is like a newspaper - and I put #primary and #secondary side by side, then wanted a 2 column wide div above that. You can see it here:
    http://www.dottywood.org/wordpress/

    Posted 8 years ago #
  11. @elderberry - neat work! you are right that is quite a good use of another widget area above primary.

    @soupking - well there is a TON of good info in the codex. i reference the page on conditional logic all the time and send a few people there every week. i don't want to sound like a jerk either, but it can be somewhat frustrating answering the same questions repeatedly, or answering questions there the information is already available had someone done their research. for instance adding content below the header is the same as adding something above the footer. the process is the same, but you need a different hook. or doing something on a 'page' only means you have to understand wordpress conditional logic, or modifying the query- both of which you can get good examples of at the codex.

    what this does tell me, however, is that while there is a lot of good docu out there, finding what you need as a newb isn't easy. i hate to admit it, but there are times when i can answer questions on here by pointing people to a post that i REMEMBER the answer being on. so i can search for it by title or author and get it, but you can't and don't search like that when you barely understand what is going on.

    it is something we'd love to see addressed in the future and will really push thematic to new levels of awesome.

    Posted 8 years ago #
  12. elderberry
    Member

    @helgatheviking Thanks :-)

    "what this does tell me, however, is that while there is a lot of good docu out there, finding what you need as a newb isn't easy. i hate to admit it, but there are times when i can answer questions on here by pointing people to a post that i REMEMBER the answer being on. so i can search for it by title or author and get it, but you can't and don't search like that when you barely understand what is going on. "

    This is very true - I would be willing to help even though I am not much of a coder, I know there's an effort at a wiki happening and a donated domain name - is there something I can do to help?

    Posted 8 years ago #
  13. soupking
    Member

    "what this does tell me, however, is that while there is a lot of good docu out there, finding what you need as a newb isn't easy. i hate to admit it, but there are times when i can answer questions on here by pointing people to a post that i REMEMBER the answer being on. so i can search for it by title or author and get it, but you can't and don't search like that when you barely understand what is going on. "

    No, you don't sound like a jerk. But there's very basic things that you've pointed out in this forum that can't be found anywhere. If you're used to building sites in CSS/XHTML and then you're thrown into PHP functionality, the codex (while being incredibly useful) is not going to mean anything. The whole experience felt like landing in France. Anything that comes out as a question doesn't make any sense. It's very hard to even understand (for dummies like me) what is pre-defined as part of a system, and what is unique to the developer. You can read the codex and blog responses, but if they don't pertain to your exact theme, it doesn't make any sense. And there's nobody to point this out. Know what I mean? :D

    And then on top of it, the overall attitude is it's so easy, like it's Spanish, and then you feel even dumber (lol).

    Again, THANK YOU! I'll find me way back to the codex I'm sure now that I get it. Thematic should be thought of as THE twentyten for CSSers. Without this site, I'd be chasing my tail for hours. I won't say another negative word. :)

    Best wishes!
    -soupking

    Posted 8 years ago #
  14. @elderberry - we're a little stuck on the wiki project atm, trying to figure out where to put it and on what platform. i'd prefer to see it at themeshape.com somewhere, but chris and ian are busy and not the easiest to get in touch with right now.

    @soupking - yes there are some things that i post that can't be found elsewhere, but there is plenty that i've already posted once. and a LOT of things that are actually the same question in disguise. i answer a lot of questions with a link to where the question was already answered. as i said, part of this is my memory and spending too much time here and the other part is it being difficult for a newb to know what to look for.

    as someone who lived in France for 2 years, i know exactly what it feels like to "land in France!" :) for thinking that i had learned some french in school, i couldn't order water on one of my first outings b/c my pronunciation was so rubbish. talk about feeling dumb.

    i think codex stuff applies across the board to all themes, or i guess, more correctly, every theme CAN use the functions in the codex. they are wordpress functions, NOT theme-specific functions. WP is essentially a collection of functions that interfaces with a database. your theme is sort of the "black box" that talks to WP and turns the content into html markup. child themes of thematic add another magical "black box" as you have another layer of communication/functions where your child theme tells thematic what to do, which tells wordpress what to do. huge learning curve, but extreme flexibility and modularity.

    keep reading posts, keep asking questions, learn the basic premise of add_function and add_filter and you'll have a pretty good grip on how how to change almost anything. actually i found that when i started answering questions, that was when i learned the most.

    Posted 8 years ago #
  15. @helga
    unsure whether the new wiki will be found on themeshaper.com. its now home to automattics premium theme venture

    Posted 8 years ago #
  16. @jonny, good to know. it just seemed the most logical place considering it is already where thematic is, where the forum is, where the current docu is and as such, where people already come to for answers.

    that said- i just went to the themeshaper.com homepage and can no longer even find a link to Thematic nor the forums. i wonder where the thematic project is going to live? does it need a new home?

    Posted 8 years ago #
  17. its a bit frustrating really. we are all waiting to contribute to a new wiki but have no idea whos responsible and too where its being hosted?

    themeshaper no longer having a direct link to thematic only means further confusion for new people searching/finding the framework.

    thematic needs a home soon
    http://www.chartstats.com/images/artwork/3520.jpg

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.