?
Solved

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

Posted on 2008-10-16
6
Medium Priority
?
1,187 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 240 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 240 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
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

WordPress has made it easy to create scalable sites based on their powerful CMS, but as great as WordPress is, there are some SEO issues that haven’t been addressed out of the box.  Fortunately these problems can be solved with a few plugins.  The f…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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 set up the permalinks on a WordPress Website. 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 : Go t…
Suggested Courses

765 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