Solved

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

Posted on 2008-10-16
6
1,176 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

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 …
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 Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

738 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