Solved

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

Posted on 2008-10-16
6
1,166 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
  • 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you are looking for plug-ins to add functions to your WordPress small business web site, take some time to read though this comprehensive list.  These are all the plugins I use for my customers WordPress web sites, as well as my own.  Be sure to …
How to create your own WordPress Theme Before I begin with the theme design tutorial, I would like to give you the basics of what is required to make a WordPress Theme. The most basic WordPress theme only requires 2 files: a style.css file and an…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now