How to add my own widget blocks to wordpress theme


Author Message
Jeff

Posted: 10/19/2012
Quote message 

I finally figured out how to do this with Joomla but the only thing keeping me from completely using Wordpress/Artisteer.

I want to add areas for more widgets. Please se http://www.jeffsdevserver.com/artisteer-wp1.jpg


 
Tiffany

Posted: 10/21/2012
Quote message 

Quote :
I finally figured out how to do this with Joomla but the only thing keeping me from completely using Wordpress/Artisteer. I want to add areas for more widgets. Please se http://www.jeffsdevserver.com/artisteer-wp1.jpg


I am querying the same thing. In V3 & V4 betas it was fairly straightforward, you could add and remove widget/sidebar areas by editing the Sidebars.php file and configuring the CSS in the styles.css file + adding or moving the php sidebar calls as needed.

Now, with the final release of V4 I am at a loss. My Sidebars.php file does NOT contain any of the Sidebar arrays for each of the widget areas so that I can modify them to add or remove them as I need. I am stuck with just the defaults in place (that work fine and as required). Yet I want more functionality without having to get Templateer or anything of the like.

I love Artisteer and simply want to be able to modify the files as I see fit for the purpose of my clients.

I currently want to change the 2 bottom sidebars to be 4 inline. I do NOT want to use Tables to do this, I want to be able to edit the sidebar php as before.

Can anyone help with this, thanks.

I would give you a url but I am working on multiple projects that are still under construction with std landing pages in place until the release.

Hoping for a quick resolution. Thanks


 
Tiffany

Posted: 10/21/2012
Quote message 

Scratch that!!!
I figured it out. Turns out there are 2 files that are named similar yet I had not noticed it previously... my bad, anyway... these are - Sidebar.php and Sidebars.php

Sidebars.php allows me to add the extra widgets as needed...

'bottom' => array( 		'name' => __('First Bottom Widget Area', THEME_NS), 		'id' => 'first-bottom-widget-area', 		'description' => __("This sidebar is displayed below the main content.", THEME_NS) 	), 	'bottom2' => array( 		'name' => __('Second Bottom Widget Area', THEME_NS), 		'id' => 'second-bottom-widget-area', 		'description' => __("This sidebar is displayed below the main content.", THEME_NS) 	),


Below this section I can simply add the arrays I needed by copying this code / pasting it below the above section and giving it the appropriate names as follows...

'bottom3' => array( 		'name' => __('Third Bottom Widget Area', THEME_NS), 		'id' => 'third-bottom-widget-area', 		'description' => __("This sidebar is displayed below the main content.", THEME_NS) 	), 	'bottom4' => array( 		'name' => __('Fourth Bottom Widget Area', THEME_NS), 		'id' => 'fourth-bottom-widget-area', 		'description' => __("This sidebar is displayed below the main content.", THEME_NS) 	),


Save, Refresh the Widgets Page in Dashboard and I see the new widget areas appear appropriately.

RE Jeff's post above, to create a new widget area above the bottom area, you need to follow the same methods as previous posts... this is one of my favorites that I simply applied the concept to suit my needs: http://reflectingthedesigner.com/wordpress/2011/03/09/adding-a-widgetized-sidebar-to-your-header/

In summary:

Create a new sidebar.php (or so as not to confuse create sidebar-bottom.php file) only name and save it to something like "sidebar-abovebottom.php" using a text editor like Notepad or Notepad++.

Copy the Code from any of the sidebar php files... should look like this:
<?php

$places = theme_get_sidebar_places('bottom');
$count_widgets = array_sum(array_map('count', $places));
if($count_widgets > 0) {
theme_print_sidebar('bottom', $places);
}
?>


only change it to reflect the call name for your new area
<?php

$places = theme_get_sidebar_places('abovebottom');
$count_widgets = array_sum(array_map('count', $places));
if($count_widgets > 0) {
theme_print_sidebar('abovebottom', $places);
}
?>


Once saved upload to your WP-Content folder via cpanel or FTP.

Open in an editor the Sidebars.php file, (not the sidebar.php) as mentioned at the top of this post, and add the new Arrays for your widget areas only you would need to add 4 of them with names like "abovebottom1" like so
'abovebottom1' => array(

'name' => __('First AboveBottom Widget Area', THEME_NS),
'id' => 'first-abovebottom-widget-area',
'description' => __("This sidebar is displayed below the main content.", THEME_NS)
),
'abovebottom2' => array(
'name' => __('Second AboveBottom Widget Area', THEME_NS),
'id' => 'second-abovebottom-widget-area',
'description' => __("This sidebar is displayed below the main content.", THEME_NS)
),

Etc. (For 4 areas you would have to create 2 more as above)

And once you have created all 4 areas - Save the file (if edited externally you will need to upload and replace the original Sidebars.php in WP-Content - if you edited using the Editor section inside WP Dashboard admin area then you're good to move on!)

Now to add to the Options.php file:
Locate this section
 array(

'id' => 'theme_sidebars_style_bottom',
'name' => __('Bottom sidebars', THEME_NS),
'type' => 'select',
'options' => $theme_sidebars_style_options
),

Copy to text editor and replace all references to 'bottom' to be 'abovebottom' (or whatever sidebar name you chose. Then paste it between the arrays for 'top' and 'bottom' (the one you copied to begin with) so that it looks like this:
 array(

'id' => 'theme_sidebars_style_abovebottom',
'name' => __('AboveBottom sidebars', THEME_NS),
'type' => 'select',
'options' => $theme_sidebars_style_options
),

Save the file (again if done in the Dashboard Editor then you're done, if editing the options.php externally you will have to upload and replace the original in WP-Content folder)

If you are using V4.0 final - you also like to add it to the Defaults.php file -
find
'theme_sidebars_style_top' => 'post', 	'theme_sidebars_style_bottom' => 'post',
and insert your new sidebar default between the two... this is just to keep it in order for your reference only... add
'theme_sidebars_style_abovebottom' => 'simple',


Then go and add the call tag to the right file/files... Also can be done in the Editor Dashboard of WP Admin or externally... anything done externally must be saved and uploaded to replace the original in the WP-Content folder...
This would be resemblant of your call tag... just change the sidebar name to whatever you opted for:
<?php get_sidebar('abovebottom'); ?>


to the file you are applying this to... in your case this would be the page.php & single.php if you want it to be inside the sheet OR to the footer.php instead to appear in the footer section.

Add directly above this section in page and single and after the closing ?>
<?php get_sidebar('bottom'); ?>

<?php get_footer(); ?>


Or to the Second line in Footer.php where at times there appears to be an empty sidebar call.
 </div>

<?php get_sidebar(); ?>
</div>
</div>
</div>
</div>
<footer class="art-footer clearfix"><?php get_sidebar('footer'); ?>


Style the CSS accordingly in your style.css file (see the referenced URL link above)


Hope this helps you and anyone else out, Jeff!!!

 
Peter S

Posted: 10/23/2012
Quote message 

Brilliant work Tiffany!
 
calsnoboarder

Posted: 1/31/2013
Quote message 

Does this still work for Artisteer 4.1 (latest release candidate? I ask because the files I see and the code in the sidebar.php and sidebars.php is not the same as it is listed here.

I want to add a widget position that sits above the content area and right/left sidebars...

so the structure would look like this:

header
horizontal menu
wide sidebar
content primary sidebar
footer

make sense? Essentially i want a new widget area that stretches from left to right and sits below the horizontal menu but above both the content area and primary sidebar area.

Anyone have any luck doing that?
 
Mat

Posted: 2/25/2013
Quote message 

Hi calsnoboarder,

Did you have any luck with this?

I'm trying to do the same and struggling!!!