• I am using Theme 2014 at https://xplor-india.com/

    Basically I am making a site for affiliate & adsense programs. I have some queries about pasting html codes into the site for showing the links to adsense or other affiliate programs. I tried doing it by going to:

    widgets>Text> Added the HMTL code here

    Ads were successfully added into my site as you can see on the right side (amazon), but I want to use different links/ads for each page of my site as topics are different for each page and I want to paste the html links differently according to the topic, but when I pasted it in the way shown above, it is showing same ads/links in all pages of the website.

    How can I add different links into different pages? Is it possible in any way?

    Thanks for the help in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Xploreindia,

    My guess is that you’ll need different sidebars according to the topic of the pages so that you can add different links to your ads in your widgets.

    For example, sidebar-home.php would be called from the home.php template file and will display links that go to Amazon. sidebar-about.php would be called either from a specific template file for the about page or from page.php to display ads with links to something else, etc.

    I hope this has suggested a way you can achieve what you’re looking for.
    Don’t hesitate to reach out if you have more queries ??

    Best,
    – Maria Antonietta

    Thread Starter xploreindia

    (@xploreindia)

    Thanks for your support. But how do I add or edit it? Please send some links, pages where there are step by step guides. Thanks

    I try to give you some guidance as best I can: I’ve just replicated and solved your issue on my local WP install, but it’s a bit convoluted.

    Let’s say you’d like to add different links to the content sidebar in the about page in 2014 theme. The steps involved would be:

    #1: create child theme
    #2: create about.php in child theme and paste contents from page.php of parent theme
    #3: at the bottom of about.php in child theme (where you just pasted contents from 2014 page.php file) you find the call to the content-sidebar. It looks like this:

    <?php get_sidebar( 'content' ); ?>

    Replace content with about, like this:

    <?php get_sidebar( 'about' ); ?>

    Then at the very top, add the comment for the page template, so that WP recognizes the new template. This is what the top of your template should look like:

    <?php
    /**
    * Template Name: About Page
    *
     * @package WordPress
     * @subpackage Twenty_Fourteen_Child
     * @since Twenty Fourteen Child 1.0
     */

    #4: Create sidebar-about.php and add the new sidebar code:

    if ( ! is_active_sidebar( 'sidebar-about' ) ) {
    	return;
    }
    ?>
    <div id="sidebar-about" class="content-sidebar widget-area" role="complementary">
    	<?php dynamic_sidebar( 'sidebar-about' ); ?>
    </div><!-- #sidebar-about -->

    I’ve kept the content-sidebar class but changed the id of the sidebar to sidebar-about. Now the CSS styles that apply to the content-sidebar will also apply to the sidebar-about.

    #5: add a functions.php file to your child theme and enter the code that registers the sidebar:

    function twentyfourteen_child_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'Sidebar About', 'twentyfourteen_child' ),
    		'id'            => 'sidebar-about',
    		'description'   => __( 'Additional sidebar that appears on the right of the about page.', 'twentyfourteen_child' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h1 class="widget-title">',
    		'after_title'   => '</h1>',
    	) );
    }

    #6 Your sidebar should be ready to go. Add your specific links to the text widget and save them. Then create the About page inside WP Page editor and apply your newly created template to it from the templates dropdown box: About

    This should be all.

    I hope it works for you. Don’t hesitate to reach out if you need more help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Theme 2014’ is closed to new replies.