Solved

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

Posted on 2008-10-16
6
1,169 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
Transferring a wordpress site from a host or local dev server to another host can be a pain. So I've included my steps on how I have accomplished this task. Steps include an assumption that you have Cpanel access or Ftp access.. If you do not hav…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…

773 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