Using Query Posts plugin in non-widget area
I'd like to use Query Posts to organize a page of posts as a portfolio. How do I use it in the center column, rather than as a widget/sidebar?
|
There is no widget area in the center column so you'd have to manually add it in index.php
|
adding Query Posts or other plugins to center column
Would it be feasible to post the code to insert a plugin (ie. Query Posts) in the center column and where it goes in index.php? I'm comfortable with html and css, but not so much with the php.
|
It is just a convention to name widget areas "sidebars", they don't need to be a "bar on the side". Adding a new widget is a 2 step process.
1. Add widget area code to functions.php. This changes in 3.3.4. I am posting the new code for 3.3.4. You can use this and replace the whole section from line 7 to (including) line 41 in functions.php of 3.3.3 with this new code (both the black and the green part, everything that is bold): // Sidebars: if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name'=>'Left Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h3>', 'after_title' => '</h3></div>', )); register_sidebar(array( 'name'=>'Right Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h3>', 'after_title' => '</h3></div>', )); register_sidebar(array( 'name'=>'New Widget Area', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h3>', 'after_title' => '</h3></div>', )); } GREEN = new widget area. The new widget area will be listed at Site Admin -> Widgets -> Current Widgets -> (Drop down select menu) "New Widget Area" [Show] New Widget Area = Title under which this widget area will be listed at (Drop down select menu) "New Widget Area" [Show] 2. Put the corresponding, actual widget area somewhere into the layout by editing the appropriate template file, i.e. index.php right after get_header(); ?> to put the new widget area at the top of the center column: <?php // Widgetize the New Widget Area: if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <!-- Here you can put some default content, which will be removed once the first widget was added to this widget area. You can also leave this blank to have no "hard coded" default content --> <?php endif; ?> 3 because this is "the 3rd from top in the list of widget areas defined in functions.php". |
I've successfully added a widgetized area at the top of the center column. However, I would rather have it at the very top, even before the container starts, as at http://www.cnn.com/. This would let me get rid of an ad group to the right of our logo. I tried putting the widget code just before
Code:
<?php get_header(); ?> |
To add it right below the header, add it after
<?php bfa_header_config($bfa_ata_configure_header); ?> in header.php |
That didn't work. I couldn't get anything to show up when I was trying an image. I tried just the word "testing" in a text widget, and it showed up, but not where I want it. It appeared under my category menu bar.
I want it above all of the content, above the container itself, not above the sidebars and center column. Also, remember we modified the header so I'd have 3 cells? EDIT: OK, I think I have it. I put it here: Code:
<body<?php echo ($bfa_ata_html_inserts_body_tag != "" ? ' ' . apply_filters(widget_text, $bfa_ata_html_inserts_body_tag) : ''); ?>> EDIT 2: Well. It worked, sort of. I had to take it down because our new edition is published tonight, so I can't have the page looking weird right now. What happened was that the images did show up, but when the page first loaded, the image was all the way to the left, outside the structure of the page. When the next image in the slideshow loaded, the whole thing popped back up top where it's supposed to be, and ran OK after that. I assume I need some kind of div there to hold it in place? |
The place where you put it is outside the whole layout, the width wrapper etc.
header.php: </colgroup> put it here (above header, in it's own <TR>...</TR>) as: <tr><td colspan="<?php echo $bfa_ata['cols']; ?>"> ... <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <?php endif; ?> </td></tr> <tr> <!-- Header --> <td id="header" colspan="<?php echo $bfa_ata['cols']; ?>"> or put it here (above header) as: <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <?php endif; ?> <?php bfa_header_config($bfa_ata['configure_header']); ?> or put it here (below header) as: <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <?php endif; ?> </td> <!-- / Header --> </tr> <!-- Main Body --> <tr id="bodyrow"> |
OK! I got that working! Thank you!
|
All times are GMT -6. The time now is 03:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.