Add Recent global posts widget to other multisite blog via theme editor

Hi, i use theme files to place some ads to users blogs on my multisite in sidebar.
i place ads in theme files and its appears in sidebar, uses cant remove it.
User have option to add recent global post widget to their blogs but i want to place it on all blog,

i add that using this
<div class="widget-sidebar frontier-widget" >
Your ad code here
</div>

Could you help me how to add recent global posts widget here.
if i insert [do_widget "recent global posts" ] like its on main site and works on subdomains/blog it doesent

Please help me, thanks

  • Adam Czajczyk
    • Support Gorilla

    Hello Nikola,

    I hope your day is fine!

    You're using our "Recent Global Posts Widget" plugin, am I right?

    In order to use it on other sites first make sure that all the requirements are met:

    - you've got our Post Indexer plugin up-and-running on your network
    - this line is added to your site's "wp-config.php" file just before the line that says That’s all, stop editing!:

    define('RECENT_GLOBAL_POSTS_WIDGET_MAIN_BLOG_ONLY', false);

    I assume you're using "amr shortcode any widget" plugin, is that right? I think that's where the [do_widget "recent global posts" ] come from.

    That said, this shortcode will work when added directly via WP editor but not inside the template file. You should then wrap it in "do_shortcode()" function like this:

    <div class="widget-sidebar frontier-widget" >
    <?php echo do_shortcode('[do_widget "recent global posts" ]'); ?>
     </div>

    I hope that helps!

    Best regards,
    Adam

  • Nikola
    • The Incredible Code Injector

    @Adam Czajczyk i do that and its ok, but there is a problem, if user remove widget from shortcode widgets in their dashboard its again not showing,
    see image, if user remove it from there it dissapear

    Tell me, is possible to make on my site blank page with widget, i do that here http://home.bettingtip.info/widget/

    and then to add this code in theme files

    <iframe src=&quot;http://home.bettingtip.info/widget/&quot; border=&quot;0&quot; frameborder=&quot;0&quot; width=&quot;300px&quot; height=&quot;400&quot; scrolling=&quot;no&quot;></iframe>

    also i will add some css, i already removed wp topbar

    you just need to help me with CSS how to remove space above widget head.
    also, then i can use that code as promotional on other sites for advertising.

  • Adam Czajczyk
    • Support Gorilla

    Hello Nikola!

    I think calling widgets (actually calling anything, except YouTube videos maybe) via an "<iframe>" element is a workaround rather than solution, unless it's really necessary. That's because everything that's inside an "<iframe>" is not a "real" part of a site: it's like a simple web-browser embedded in the page.

    That said, I just came across another thread of yours regarding pretty much the same issue. Take a look here please at @Sajid's solution:

    https://premium.wpmudev.org/forums/topic/widget-after-post-in-functionsphp-multisite#post-922191

    I understand there was an issue with Recent Global Posts not being displayed on sites other than main site but that should be addressed with the

    define('RECENT_GLOBAL_POSTS_WIDGET_MAIN_BLOG_ONLY', false);

    line in "wp-config.php" file.

    That said, have you given this another try? Doesn't it work for you? If so, what are the results/errors?

    Best regards,
    Adam

  • Nikola
    • The Incredible Code Injector

    @Adam Czajczyk I rembered that theme with @Sajid but cant remember why i had problems, its working now, thanks a lot guys great help, one more easy thing, can i add it in

    <div style="height:120px;width:120px;border:1px solid #ccc;font:16px/26px Georgia, Garamond, Serif;overflow:auto;">
    HERE
    </div>

    or you have other advice for adding it in scroll box.

  • Adam Czajczyk
    • Support Gorilla

    Hey Nikola!

    I'm glad this is working for you, that's a great news :slight_smile:

    You can of course use any HTML code around that you wish. The code from that other threads starts with:

    <div class="widget-sidebar frontier-widget" >
       <?php 
    
    	$instance = array(

    so just replace

    <div class="widget-sidebar frontier-widget" >

    with

    <div style="height:120px;width:120px;border:1px solid #ccc;font:16px/26px Georgia, Garamond, Serif;overflow:auto;">

    Best regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hey Nikola!

    I took a look at your site and it seem it's now working fine. As for CSS you're asking for, this should do the trick:

    .rgpwidget .widgettitle {padding-left:10px;font-weight:bold;color:#FF0000;}

    You may want however to replace "10px" with your own value to move title as far to the right as you'd like and also replace #FF0000 color with your own as I used here just a plain red :slight_smile:

    As for where to place the CSS. It would be best to place it in your theme's style.css file if the same exact theme is being used all across the network.

    Best regards,
    Adam

  • Nikola
    • The Incredible Code Injector

    @Adam Czajczyk thanks a lot, just quick think and its solved,
    give me just ".rgpwidget .widgettitle" elements for editing post list not title i than know how to add css elements
    i tried with .rgpwidget .ttitle {.... but nothing, i cant find class or how its called in page inspector for list of posts

  • Adam Czajczyk
    • Support Gorilla

    Hello Nikola!

    I assume that by "post list not title" you mean post links inside the "Latest Betting Tips" widget (those that are red at the moment), am I right?

    The elements would be:

    .rgpwidget ul li a

    and

    .rgpwidget ul li a:hover

    First one is for "normal" state and second one is for "on mouse over" state.

    I hope that helps!

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.