Tagged: 

Viewing 30 posts - 1 through 30 (of 31 total)
  • Author
    Posts
  • #872532

    Hi,

    I want to insert some ads here: http://prntscr.com/h64i5x

    I cant find a hook to insert a widget here though. Is there one?

    • This topic was modified 7 years, 1 month ago by Genetics Ed.
    #872689

    Hey geneticsed,

    Did you use the Layout Builder for that page? If so then maybe it would be easier to put it in a Code Block element?

    Best regards,
    Rikard

    #872706

    is it allways ?
    could you take the blog-widget for it – because you don’t use it elsewhere?
    Then you can take that for it

    add this to your functions.php of your child-theme:

    add_action('ava_after_main_title', function() {
    if ( is_single() || is_singular( 'portfolio' )  ) {
        echo '<div class="container">';
    	echo do_shortcode("[av_sidebar widget_area='Sidebar Blog']");
        echo '</div>';
    }
    });

    you see the if clause – you can do all the things an if-clause can do as is_page ; is_category; is_singular(‘event’) etc

    if you don’t like to use blog widget for it
    create an own widget just by adding one in widget area maybe call it after-title

    add_action('ava_after_main_title', function() {
    if ( is_single() || is_singular( 'portfolio' )  ) {
    	echo '<div class="container">';
    	    echo do_shortcode("[av_sidebar widget_area='after-title']");
    	echo '</div>';
    }
    });

    you only have to style it than via quick css
    the width is still set via the container to your enfold width

    • This reply was modified 7 years, 1 month ago by Guenni007.
    #872713

    Yes, I have created my own widget but I cant get it to display in the correct location. I used ‘ava_after_main_title’ but it appears here: http://prntscr.com/h6fesn and not where I originally specified.

    I want it to appear on every page of my site in this location so using the Layout Builder is not a viable option.

    #872717

    i must see a live link.
    and this is a bit different to the screenshot above. On the first one it is directly under the bread-crumps (title bar)
    The woocommerce should go in that field ?
    Determine if woocommerce got his own shortcode for that.

    Now you say it is for every page – than it will be better to create an own widget area with position determined.
    This do_shortcode gives you the oportunity to place it directly above all content – the first position in main.

    to decide only from a screenshot nearly impossible.

    click to enlarge – you see this was my test – just under breadcrump before the other main content.

    • This reply was modified 7 years, 1 month ago by Guenni007.
    #872722

    As you can see I’ve added the banner ad to some pages. The homepage using Layout Builder and the woocommerce pages using woocommerce hooks.

    add_action( ‘woocommerce_before_shop_loop’, ‘adsense_hook’ );
    add_action( ‘woocommerce_single_product_summary’, ‘adsense_hook’, 1 );

    But all other pages it is difficult when no hook exists

    #872725

    can you please insert the code to functions.php of your child-theme:

    add_action('ava_after_main_title', function() {
    if ( is_page() || is_single() || is_singular( 'portfolio' )  ) {
        echo '<div class="container">';
    	echo do_shortcode("[av_sidebar widget_area='Sidebar Blog']");
        echo '</div>';
    }
    });


    and than insert to sidebar blog everything you like to view on that area.
    just to see where it is placed

    #872726

    Done.

    #872727

    so you see it is the right position –
    so now make an own widget ( without defining / registering ) just on widget area
    name it you like f.e: under-title

    maybe without divs

    add_action('ava_after_main_title', function() {
    if ( is_page() || is_single() || is_singular( 'portfolio' )  ) {
    	echo do_shortcode("[av_sidebar widget_area='under-title']");
    }
    });


    put in there the things you like

    #872728

    No it’s not in the correct position. That widget spans full width. I want mine to only span the width of the main content area as outline here: http://prntscr.com/h6fesn and in the original post.

    I do not want the widdet to span accross the left hand sidebar. Also the widget in the position you’re suggesting inserts the content into the title bar and not below it (as can be seen by the border-bottom).

    • This reply was modified 7 years, 1 month ago by Genetics Ed.
    #872730

    you want it besides the sidebar but over the first content ?

    you can now remove it – i know what you like to have

    • This reply was modified 7 years, 1 month ago by Guenni007.
    #872732

    exactly.

    #872735
    function insert_container_overmain(){
    ?>
    <script>
    jQuery(function() {
       jQuery('#main .av-content-small:first-child').prepend('<div id="overmain">  </div>');
       jQuery('#overmain').css('height', ' 120px');
    });
    </script>
    <?php
    }
    add_action('wp_head', 'insert_container_overmain');

    this will be the right position. –
    but i do not know how to get in the prepended content the do_shortcode rule

    and this is only for pages/posts with sidebar !

    #872738

    Thanks Guenni007 I’ll try it out later. Much appreciated.

    #872746
    function insert_container_overmain(){
    ?>
    <script>
    jQuery(function() {
       jQuery("#main .content.av-content-small:first-child").prepend("<div class='overmain'>  </div>");
       jQuery(".avia-section .overmain").removeClass("overmain");
       jQuery(".overmain").css("height", "120px");
    });
    </script>
    <?php
    }
    add_action('wp_head', 'insert_container_overmain');

    not knowing how to get in there the widget.

    #872929

    this is another method – but because color-section is content too it will be before it:

    function insert_before_content($content) {
    	$beforecontent = '[av_sidebar widget_area="under-title"]';
    	$fullcontent = $beforecontent . $content ;
    	return $fullcontent;
    }
    add_filter('the_content', 'insert_before_content');
    • This reply was modified 7 years, 1 month ago by Guenni007.
    #872943

    That last method outputs it beneath the content title and main image: https://futuregenetic.com/what-is-dna/

    • This reply was modified 7 years, 1 month ago by Genetics Ed.
    #872955

    don’t know what happend on your site
    ??? it is before $fullcontent = $beforecontent . $content ;

    #872958

    ok – on my end it works except if there is color-section – than it is above.
    now my skills are at their finish –

    guess you have to wait til mods are here. – Maybe there is an easy method.
    i read a lot of ajax and the possibility to get in dynamic content – but this goes over my needs to help you now furthermore.

    #872966

    one off topic question – how did you insert in footer (not socket) the social bookmarks

    #873325

    Off topic: Custom HTML widget with this code:

    <ul class="noLightbox social_bookmarks icon_count_3">
    	<li class="social_bookmarks_facebook av-social-link-facebook social_icon_1">
    	<a target="_blank" href="#" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello" title="Facebook">
    	<span class="avia_hidden_link_text">
    	Facebook</span>
    </a>
    </li>
    <li class="social_bookmarks_twitter av-social-link-twitter social_icon_2">
    	<a target="_blank" href="#" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello" title="Twitter">
    	<span class="avia_hidden_link_text">
    	Twitter</span>
    </a>
    </li>
    <li class="social_bookmarks_youtube av-social-link-youtube social_icon_6">
    	<a href="#" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello" title="Youtube">
    	<span class="avia_hidden_link_text">
    	Youtube</span>
    </a>
    </li>
    </ul>
    #873328

    aha – i wrote a custom widget for it : https://kriesi.at/support/topic/social-bookmarks-widget-how-to/

    #873331

    Nice. Thanks for that.

    #873359

    Any help from kriesi mods would be greatly appreciated. Thanks

    #873525

    Hi,

    Use the “ava_after_main_title” hook then move the adsense code inside a container with a unique id or class attribute. Create a custom script to prepend the container inside the “entry-content-wrapper” container. Example.

    
    $(&#039;.adsense-container</code>&#8216;).prependTo(&#8216;.entry-content-wrapper&#8217;);
    

    Best regards,
    Ismael

    #873877

    Seriously, that’s the easiest way?

    I’m astonished there’s no hook at the location I want.

    #874024

    Hi,

    Yes, unfortunately, there’s no available hook inside that container. You can also insert the adsense code directly inside the single.php file, just above the following code.

    get_template_part( 'includes/loop', 'index' );
    

    Best regards,
    Ismael

    #874313

    That seems like a better solution. But is it possible to insert a custom hook at that location using my child theme?

    #874494

    Hi,

    Yes, it’s possible. However, you’re just making things a bit more complicated. You can just insert the code directly in the template.

    Best regards,
    Ismael

    #874596

    ok, I copied single.php to my child theme and added the code. Thanks for the help.

Viewing 30 posts - 1 through 30 (of 31 total)
  • You must be logged in to reply to this topic.