Solved

How can i make my wordpress template..... widget aware?

Posted on 2008-10-16
6
1,181 Views
Last Modified: 2012-05-05
I had a HemingwayEx wordpress skin installed on my blog at www.trimaxs.com/blog

i used to be able to edit the "presentation" widgets ( moving widget back and forth ), but not anymore

Now it's saying:

No Sidebars Defined

You are seeing this message because the theme you are currently using isnt widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.

I've gone to the website but i can't figure it out myself ( i'm just basic html user )

as i understand it, i need to add a code somewhere

can someone help? do i need to copy paste the template's css? here's my index.php for the blog
<?php get_header(); ?>
 
 
	<div id="primary" class="twocol-stories">
		<div class="inside">
			<?php
				// Here is the call to only make two posts show up on the homepage REGARDLESS of your options in the control panel
				$category_id = $hemingwayEx->get_asides_category_id();
				is_null($category_id) ? query_posts('showposts=2') : query_posts('showposts=2&cat=-' . $category_id);
			?>
			<?php if (have_posts()) : ?>
				<?php $first = true; ?>
				<?php while (have_posts()) : the_post(); ?>
					<div class="story<?php if($first == true) echo " first" ?>">
						<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
						<?php $hemingwayEx->excerpt() ?><span class="read-on"><a href="<?php the_permalink() ?>">read on</a></span>
						<div class="details">
							<?php echo _('Posted at') ?> <?php the_time('ga \o\n ' . $hemingwayEx->date_format(true) . '/y') ?> | <?php comments_popup_link('no comments', '1 comment', '% comments'); ?> | Filed Under: <?php the_category(', ') ?>
						</div>
					</div>
					<?php $first = false; ?>
				<?php endwhile; ?>
		</div>
				
			<?php else : ?>
		
				<h2 class="center">Not Found</h2>
				<p class="center">Sorry, but you are looking for something that isn't here.</p>
				<?php include (TEMPLATEPATH . "/searchform.php"); ?>
		
			<?php endif; ?>
				
			<div class="clear"></div>
	</div>
	<!-- [END] #primary -->
 
 
 
<?php get_sidebar(); ?>
 
<?php get_footer(); ?>

Open in new window

0
Comment
Question by:trimaxs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 1

Expert Comment

by:andrewmilo
ID: 22741012
Actually, you want to do this in your sidebar.php file, not the main file.

You can read more here:

http://automattic.com/code/widgets/themes/

Essentially, you need to need to add something like this:

<ul id="sidebar">
<?php if ( !function_exists('dynamic_sidebar')
        || !dynamic_sidebar() ) : ?>
 <li id="about">
  <h2>About</h2>
  <p>This is my blog.</p>
 </li>
 <li id="links">
  <h2>Links</h2>
  <ul>
   <li><a href="http://example.com">Example</a></li>
  </ul>
 </li>
<?php endif; ?>
</ul>

Open in new window

0
 
LVL 1

Assisted Solution

by:andrewmilo
andrewmilo earned 60 total points
ID: 22741129
To add more info on my above answer, the essential parts of the above code is the:

<?php if ( !function_exists('dynamic_sidebar')
        || !dynamic_sidebar() ) : ?>

line.  That is an IF Then statement using the short notation of PHP.

Essentially, the code is saying:

IF (There Isn't a dynamic sidebar) OR (NOT Dynamic Sidebar)

Then:

Here is my sidebar.



So, the HTML code that you see there is what you will use as the sidebar IF there are no dynamic sidebars (meaning widgets).  That way, without widgets, you get a sidebar, and if you do add widgets, that HTML code won't be used.


You can also use multiple sidebar areas in your theme.  Instead of register_sidebar() you should use register_sidebars(n) where n is the number of sidebars. Then place the appropriate number in the dynamic_sidebar() function, starting with 1. (There are several other ways to use these function. See the API here: http://codex.wordpress.org/Plugins/WordPress_Widgets_Api).

You can even give your sidebars names rather than numbers, which lets you maintain a different set of saved sidebars for each theme.

Hope that helps!

Cheers,
A
0
 
LVL 1

Assisted Solution

by:andrewmilo
andrewmilo earned 60 total points
ID: 22741236
Hmm, the latest HemmingwayEX seems to work with Widgets, as do prior versions:

http://www.nalinmakar.com/hemingwayex/


"Widgetized: This theme is best used with Widgets. Out-of-box, v1.5 Final works only with widgets. This version removes the support for Hemingway Blocks. To have the option of using Hemingway Blocks instead of widgets, please stick with v1.1. By setting an option in v1.1, you can select whether you want to use the original blocks system of Hemingway themes or use widget enabled sidebars."


Did you change anything with the files?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:trimaxs
ID: 22746752
hi there, i've opened the sidebar.php and it only has the following code
<?php
include (TEMPLATEPATH . '/dynamic_bottombar.php'); 
 
// If you want to ignore the Theme Options handling of the sidebar and just do it yourself
// Use this one instead of the above
// include (TEMPLATEPATH . '/static_sidebar.php'); 
?>

Open in new window

0
 

Author Comment

by:trimaxs
ID: 22746829
i've read the blog you mentioned and is aware that the following line:

<?php if ( !function_exists('dynamic_sidebar')
       || !dynamic_sidebar() ) : ?>

should be used. But i'm just not sure where to put it.

I think i've edited the blog, but only to add google analytics code.

Currently in the process of downloading the latest hemingwayex template and will try to replace the existing one
0
 

Accepted Solution

by:
trimaxs earned 0 total points
ID: 22746926
problem solved! i've replaced the entire template and now it works again
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question