• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to add a Right and Left Side(bar) Widget with a Field for Affiliate Links

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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 is: not resolved

Tagged: a Field for Affiliate Links, Left Sidebar Widget, Right sidebar widget

  • This topic has 5 replies, 2 voices, and was last updated 8 years, 2 months ago by milada.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 28, 2017 at 7:40 am #203958
    milada
    Member

    Hi 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/post

    I 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.com
    March 28, 2017 at 8:38 am #203959
    Victor Font
    Moderator

    What 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 #203960
    milada
    Member

    Thank 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 #203988
    Victor Font
    Moderator

    Use 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 #203989
    milada
    Member

    Thank you for the hint!

    Milada

    March 31, 2017 at 11:51 am #204127
    milada
    Member

    Unfortunately, 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

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble