Comment on SEO Silo Theme by SEO Dave.
Added the Widgets Anywhere feature to Stallion Responsive 8.1 and not wrote a tutorial per se yet, but there’s full instructions on the Widgets Anywhere options page “Stallion theme” >> “Widgets Anywhere”, so wouldn’t be adding much to that information.
This assumes you’ve turned the Widgets Anywhere feature on under
“Stallion theme” >> “Layout Options” : “Stallion Widgets Anywhere On”
Stallion is built in a modular way, if a feature isn’t used there’s nothing loaded to waste resources.
From the widgets anywhere Options page:
To use within a WordPress Post or Page
Edit the Post/Page and include the relevant shortcode for a widget area you created above into the area of the content you want the widget area to load.
Anywhere Widget Area 1: <div class="sidebar-box"></div> Anywhere Widget Area 2: <div class="sidebar-box"> </div> ...
The surrounding code is so your widgets use all the font styles etc… widgets on sidebars use. If you want to NOT use all styles use the plain shortcode only.
Anywhere Widget Area 1:
If for example you wanted a “Tagcloud” to load in the middle of the content of a handful of posts (not sure why anyone would want that, but here goes :-)). Under “Appearance” >> “Widgets” you’d drag n drop a “Tagcloud Widget” into say the “Stallion Anywhere Widget Area 1” widget location. Add whatever settings for that widget you wanted (same as you would if you wanted to create an Tagcloud on a sidebar).
Edit each post you wanted this widget to load within the content and add
to the part of the content you want the Tagcloud to load. Repeat the edit post and copy and paste
into all the posts you want this widget area on.
It’s that simple, with this feature you can add widgets anywhere within the main content of a Post/Page.
The above technique also works with the hard coded Stallion widget areas as well (left and right sidebar for example), to use you just need to set the correct ID (see list below) and if you want to use all the sidebar styling a little extra HTML code. For example to add the Right Sidebar to a post use this code:
Want the use the Left Sidebar within a post replace “st-right-sidebar” with “st-left-sidebar”.
Stallion Widget Area IDs
Left Sidebar : id = st-left-sidebar
Right Sidebar : id = st-right-sidebar
Left Sidebar Top Left : id = st-left-sidebar-tleft
Left Sidebar Top Right : id = st-left-sidebar-tright
Left Sidebar Bottom Left : id = st-left-sidebar-bleft
Left Sidebar Bottom Right : id = st-left-sidebar-bright
Right Sidebar Top Left : id = st-right-sidebar-tleft
Right Sidebar Top Right : id = st-right-sidebar-tright
Right Sidebar Bottom Left : id = st-right-sidebar-bleft
Right Sidebar Bottom Right Area : id = st-right-sidebar-bright
First Footer Area : id = first-footer-widget-area
Second Footer Area : id = second-footer-widget-area
Third Footer Area : id = third-footer-widget-area
Fourth Footer Area : id = fourth-footer-widget-area
Below Main Footer Area : id = fifth-footer-widget-area
Above Header Area : id = st-above-header-widget-area
Within/Over Header Area : id = st-header-widget-area
Below Header Area 1 : id = st-below-head1-widget-area
Below Header Area 2 : id = st-below-head2-widget-area
Below Banner Image Area : id = banner-widget-area
Floating Content Area : id = content-widget-area
Between Posts on Archives Area : id = archive-widget-area
Bottom of Blog Posts and Static Pages Area : id = bottom-content-widget-area
Page Template One : id = template-one-widget-area
To use within a Stallion Theme Template (PHP) file
If you wanted a new widget area to be added to a particular part of Stallion this can be achieved as follows. First you need to work out which php file to edit to add the shortcode, this isn’t always obvious, so will give an easy example.
single.php is the template file responsible for generating the output of WordPress Posts (page.php is for WordPress Pages).
If you make a copy of the single.php file and add it to your Stallion Responsive Child theme folder (/wp-content/themes/stallion-responsive-child/single.php) you can modify this file to add a new widget area(s). Edit your copied single.php file and add:
<?php if (function_exists('swa_template')): swa_template("swa1"); endif; ?>
Note: We add the function_exists part to check this feature is active (swa_template is a function used by this feature). If the function doesn’t exist (if in the future you disable this feature) we don’t want WordPress to try to load the widget area, would break your site.
Where exactly to add the widget area in the code is up to you, if you wanted a new widget area below the header you’d add it below the get_header code:
<?php get_header(); ?> <?php if (function_exists('swa_template')): swa_template("swa1"); endif; ?>
On WordPress Posts only whatever is added to this custom widget area will be loaded.
If you added the above to single.php you would find because the new widget area isn’t either within the sidebar or main content area the styling Stallion adds to widgets won’t work with this location, so you’d also have to add some additional code so the widget area will use the correct CSS styling. Stallion happens to have another widget area in that location for adding full width ads. You could use the same code to have your new widgt area use the correct styling:
<?php get_header(); ?> <div class="stfullwidget widget-area"> <div class="sidebar-box"> <?php if (function_exists('swa_template')): swa_template("swa1"); endif; ?> </div></div>
This would give you a full width widget area that only loads on WordPress Posts and uses the Stallion layout/styling other widget areas use. You might not want a new widget area to use the Stallion styling, in which case you wouldn’t add the additional code above and add your own CSS styling.
To use within a WordPress Page Template
Stallion includes multiple Page templates, Page templates are there to generate interesting features/layouts for a particular post or page. There are over 20 built into Stallion Responsive including multiple sitemap templates, multiple home Page templates with a combination of content and archives.
You could use the same procedure as described for single.php on one of the built in templates or even create a new one. The Stallion page templates tend to be named page-***.php. page-comments-on-top.php for example is a page template that puts the comments at the top of the content rather than below it.
You could also make your own, page-example.php is there for you to create new page templates easily.
Stallion also includes category template files for example category-full.php which when selected (via a Stallion feature) results in the category outputting full posts on the categories rather than excerpts. You can edit these the same way as described for single.php, there’s an example category template category-example.php for your use.
Regarding the Stallion SEO Posts Widget missing.
Have you disabled the Stallion SEO Posts widget by mistake under
“Stallion Theme” >> “Performance Options” : “Unregister Widgets”
Each ticked box will disable that widget completely.