This topic has 16 replies, 4 voices, and was last updated 9 years by sharmstr.

  • Author
  • #44964

    I am looking for a good solution for this.

    I am getting requests on my news media website for advertising, and to use the top part of the website before the content. I already use the sidebar area for advertising across the entire website, but some want some more visible areas right at the top (and I can sell those spots for more).

    I have attached an image of the top of my website. I am thinking I can put two images side by side at say 500×100 pixels centered, and either within the grey area, or in the white area before the content (spanning the whole section before it splits the main and sidebar area). Of course, I want this site wide, so just putting it within a page like the home page is not an option (since I would have to duplicate that code across all pages, and that wouldn’t include the news pages).

    So it appears I would have to do this by editing a theme template page. I have two questions with this.

    1) What theme template pages are the best places to place coding in for these specific areas?

    2) What is the best html coding I should use? Also, is there a way to put coding in that pulls from a specific sidebars? It would probably be easier for me to put in some sort of custom sidebar coding withi a theme template page, and then only change the sidebar info depending on the adverts needed to be placed in there.

    Thanks!

    #44965

    Forgot to attach file.

    Attachments:
    You must be logged in to view attached files.
    #44970
     Radu
    Moderator

    Hello

    You can add a advertise on you header easier.

    Go to Theme Options -> Header Settings -> Header Layout -> Select Last

    And then you can paste you html/js code ( see screenshot )

    Have a nice day

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    Attachments:
    You must be logged in to view attached files.
    #44973
     Radu
    Moderator

    I’m not sure if i understand what you mean in point 2,

    But if you want to show some banners by category or taxonomy you can use this plugin.
    https://wordpress.org/plugins/content-aware-sidebars/

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #44975

    Radu, thanks for the replies. On your first posting, that is a decent option, but I found a few issues with it when I tried to use it for my application.

    1) The height of the area is a bit confusing. No matter what adjustments I made to the area sizing, it made the navigation very tall and created too much spacing. See attached image. I actually really like using this option to create an advert area alongside the logo and have the menu under, but I hate all that extra space above and below the menu links. If I can figure out how to eliminate all that space (see attached screenshot), I might use this option.

    2) I still would need additional advertising space at the top of the website for additional sponsors, so while this option would be great to create one ad spot, it doesn’t allow me to create additional advertising spots.

    Attachments:
    You must be logged in to view attached files.
    #44980
     sharmstr
    Moderator

    You should read up on wordpress actions. They allow you to inject things into places that theme/plugin developers have specified. If you look at kleo/header.php you’ll see a do_action called ‘kleo_before_main’. That action lets you inject whatever you want before the title/breadcrumb section. So instead of editing core files, you can use a add_action routine in your functions.php file.

    COPY CODE
    
    add_action('kleo_before_main','display_advertising');
    function display_advertising() {
    	echo "my ads here";  //you could put a shortcode here if you want, too.
    }
    

    So, its add_action(‘where’,’what’);

    I dont specifically see an action for adding it just after the title/breadcrumb and before the page divides itself into sections, but you can add your own action. Copy /kleo/page-parts/general-title-section.php to your child theme and add do_action(‘kleo_after_title’); to the very bottom. Then you can use the above example, but put in kleo_after_title instead of kleo_before_main.

    If you want to target the area just above the content, but not above the sidebar, then use ‘kleo_after_main_content’

    You can even get tricky with it and specific pages like.

    COPY CODE
    
    add_action('kleo-after-title','display_advertising');
    function display_advertising() {
    	if ( is_front_page() ) 
    		echo "my ads here";
    }
    

    The is_front_page() will only inject it into the front page.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #44981
     sharmstr
    Moderator

    Sorry guys, it took me some time to type up my reply and it seems I’ve jumped in the middle here.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #44984
     Radu
    Moderator

    If you use 728×90 banner the empty space will be less.

    If you want to create extra advertising blocks in header you can modify header php file wich is located here : wp-content/themes/kleo/page-parts/general-header-section.php

    Hope you understand

    Best Regards

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #44989

    sharmster, no problem on jumping in. I like getting opinions from different directions. I will have to read up more on that. I try not to mess with too much programming as I seem to put one thing in the wrong area and bork it all up. haha

    One thought though on the sidebar usage of what I was mentioning to clarify.

    Say I created two sidebars called “top_advert_left” and “top_advert_right” and within each I have a text widget that has, for instance, this:

    COPY CODE
    <a href="http://www.stixfx.com"><img class=" size-full wp-image-15 aligncenter" src="http://legendsnation.com/wp-content/uploads/2015/01/advert-sfx-ontrack-500x100.jpg" alt="advert-sfx-ontrack-500x100" width="500" height="100" /></a>
    

    I know from playing around with adding a revolution slider in on the pages which themes I have the PHP code to drop in (and general locations from that discussion before and info above on theme pages). But what code do I use specifically to drop in a sidebar and format it as such (see the example image). Again, maybe I am thinking the wrong thing here, but the reason I thought about adding the code into the theme page and then just updating the code on the widget is for ease of location (so I don’t have to go into the theme to alter the advert … can be done within the widget text for the sidebar).

    Also, Radu, the left / right spacing I am not concerned with on that example. It is the gap spacing above and below the “HOME ABOUT” etc strip. For the life of me I cannot find a way to shrink that spacing down that makes the height of the menu area taller than needed or wanted.

    #44990

    Dangit! Forgot to attach image example. I am too quick to click submit. haha

    Attachments:
    You must be logged in to view attached files.
    #44992

    Also, I have inserted HTML coding into the theme page at one point to test it out and it works pretty good (mobile is a bit funky, so I have to play with that). But I wasn’t sure what the “best” way to do this would be. Essentially looking for ideas from you all.

    #47461
     mitchcan
    Participant

    Hi,

    Hope you don’t mind me jumping in, but I have a question about the info posted by @sharmstr in #44980 above.

    I added the entirety of /kleo/page-parts/general-title-section.php (except the opening php of course) to my kleo child theme; then added the do_action(‘kleo_after_title’); to the very bottom.

    Unfortunately, it then threw an error of: Fatal error: Call to undefined function kleo_title() in /url…/wp-content/themes/kleo-child/functions.php on line 41

    which in this case, line 41 was: $title_arr[‘title’] = kleo_title();

    Can anyone help me with what went wrong there?

    Thanks.

    WP 4.1.1
    Kleo 2.4.1

    #47469
     sharmstr
    Moderator

    (except the opening php of course)

    Huh? Why not? You should copy the entire file using the same directory structure.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #47470
     mitchcan
    Participant

    LOL. My bad, I should have explained that better… I already had that opening code on the page. 🙂

    I wouldn’t add that *twice* would I? I already had this… then I added the other below it.

    COPY CODE
    
    <?php
    /**
     * @package WordPress
     * @subpackage Kleo
     * @author SeventhQueen <themesupport@seventhqueen.com>
     * @since Kleo 1.0
     */
    
    /**
     * Kleo Child Theme Functions
     * Add custom code below
    */
    
    /* this added a sidebar above content below header - but likely only works on Kleo pages */
    add_action('kleo_before_main','display_advertising');
    function display_advertising() {
    	echo '<div id="my_ads">', do_shortcode('[widgets_on_pages id="wop-2"]'), '</div>';  //you could put a shortcode here if you want, too.
    }

    Do I need to do something different?

    Thanks.

    #47471
     sharmstr
    Moderator

    NO. You dont add it to your functions file. You COPY the ENTIRE file to your child theme directory using the same file structure.

    /kleo-child/page-parts/general-title-section.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #47473
     mitchcan
    Participant

    Ohhhhhh. I’m so used to copying stuff to functions, I read right through the instructions. Braincramp. LOL.

    I’ll go do as I was supposed to and be on my way. 🙂

    Thanks as always for the timely point in the right direction. 🙂

    By the way, is there an easy way to find the various locations of the places I can insert into? like kleo_before_main, etc… Again, I’m new to this theme, and also use Genesis where there is a long list I can access in a dropdown with a plugin. Thanks!

    #47475
     sharmstr
    Moderator

    I use my php editor to search in the kleo folder for do_action 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 17 posts - 1 through 17 (of 17 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?