Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to add a Right and Left Side(bar) Widget with a Field for Affiliate Links
- This topic has 5 replies, 2 voices, and was last updated 7 years, 10 months ago by
milada.
-
AuthorPosts
-
March 28, 2017 at 7:40 am #203958
milada
MemberHi all,
I have created two widgets with this code:
function wpb_widgets_init() {register_sidebar( array(
'name' => __( 'Main Sidebar', 'wpb' ),
'id' => 'sidebar-1',
'description' => __( 'The main sidebar appears on the right on each page except the front page template', 'wpb' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );register_sidebar( array(
'name' =>__( 'Front page sidebar', 'wpb'),
'id' => 'sidebar-2',
'description' => __( 'Appears on the static front page template', 'wpb' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}add_action( 'widgets_init', 'wpb_widgets_init' );
Now, I would like to have these widgets located:
1) on the right sidebar above the current Primary Sidebar widget (have the Genesis sample, Wellness Pro theme)
2) the second on the left sidebar - to the left from the article/postI would like to have these widgets be displayed on all pages apart from the homepage. Which file should I paste them to? I have Genesis Sample, Wellness Pro theme.
How do I add a field in these two widgets so that I can paste affiliate links to?Thank you very much in advance for your help!
Best regards,Milada
http://moreyouthfulskin.comMarch 28, 2017 at 8:38 am #203959Victor Font
ModeratorWhat you are doing is very confusing. Register sidebar does not create a widget. It creates a widget area. Widgets are created in a separate file and are written as an extension of WP_Widget.
If all you want to do is add affiliate links to the primary and secondary sidebar, why wouldn't you just use a text widget in the sidebars?
If you truly want to add widget areas above the primary and secondary sidebars, you have to create your own page layout. That is a lot of effort to put in just to add affiliate links.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 28, 2017 at 8:44 am #203960milada
MemberThank you for your feedback and explanation.
Is there a way to create a field on the left from the article to put there affiliate links, in case?
Thank you for letting me know.Milada
March 28, 2017 at 10:57 pm #203988Victor Font
ModeratorUse the 2-sidebar layout that's built into Genesis and use a text widget for the links.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 29, 2017 at 12:55 am #203989milada
MemberThank you for the hint!
Milada
March 31, 2017 at 11:51 am #204127milada
MemberUnfortunately, my Wellness Pro theme has only one sidebar. I would like to add some banners (affiliate links to text fields) on the other side of my articles (apart from one side already there). Could you please give me an advice what to do to be able to display banners on both sides of the article?
Thank you in advance.Milada
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.