Website show Google Ads when we have no Google Ads linked to our website

Today we noticed that one of our website has started showing random Google Ads on our website when we have not added any Google Ads to our website. I would appreciate if someone can help in case they have faced such scenario. I am not sure at this point if website is hacked or shared hosting server is compromised. Any points or steps i should follow to get rid of these ads on website
Category: Web

Insert ads between comments

I want to insert ads between comments. function wpse_comments_ads_injection( $comment, $args, $depth ) { static $count = 0; if ( $count == 2 ) { echo "AD 1"; } if ( $count == 5 ) { echo "AD 2"; } $count++; } add_filter( 'wp_list_comments_args', function( $args ) { if ( ! isset( $args['end-callback'] ) ) { $args['end-callback'] = 'wpse_comments_ads_injection'; } return $args; } ); I wrote this code, but because of it the tag <!-- #comment-## --> </li> is deleted …
Category: Web

Have unique URLs on the ad site

For some time now I have had a problem with an ad site that I am developing with wordpréss. I am unable to generate unique pages with the post id as in this example website: ... Acer-nitro-17-gtx-1650-pid10198770 Thanks in advance.
Category: Web

How do I show google ads between post content?

I want to show ads by Google between text content, like show 3 ads one after 1st para second after 3rd para and one at end of last para. I know i have to modify in single.php but being novice in php I am unable to do this. Would be real helpful if someone could help me do this. Thanks.
Category: Web

Ad units Div-ids frequently changing

I have a strange issue with my website, the div-ids frequently changing for AD units. How to make them static? I copy the code from the Google ad unit and paste it to my site but the Div-ids frequently changing. How to fix this issue.
Category: Web

How to prevent Google adsense invalid impressions while performing admin tasks on my wordpress site?

I've added google adsense to my website. Currently I've got pretty less traffic (~3-30 visitors everyday). I'm afraid that if I use my wordpress admin panel / write a post / view a post etc then it will create invalid ad impressions. Google's policy on this is pretty vague and states the following: Can I view my own site without generating invalid impressions? Yes, you're welcome to view your own pages without generating invalid impressions. Simply viewing your pages yourself …
Category: Web

My website frequently redirect to a different advertisement URL

Can you guys help me to figure out why it's happening? Its mainly happen from my search engine result. From Google search when I click on my website it will redirect to a scam website. Note: now its look like happening everywhere on my website. I even affected when I click on a post, but it's bit rear then search engine. this is the web address I am affected by: http://mobile4494.greenyourday112.agency/2675651026/?utm_campaign=bKMuT7EMVXU5Z6UvvSHONGlfu-yV43iC8T8uYixAFxs1&t=main9_143c45092c890a12fd&f=1 and my website: https://toptenflash.com/. It so so frustrating always …
Category: Web

How to create a php url redirection for nicer links

I'm looking for a way to make a URL redirection for affiliate links on my website. Something like : site.com/go/keyword I know there is many plugins for doiing this, but i don't like plugin, and i love to learn new things. I imagine 2 custom fields for each posts with : keyword url to redirect to But i have no idea how to process this redirect file. Any help or advice is welcome. thanks !
Category: Web

How to hide Ads in between posts on AMP?

I am using the following code to show ads on my posts after Para 4:- add_filter( 'the_content', 'prefix_insert_post_ads' ); function prefix_insert_post_ads( $content ) { $ad_code = My Ad code; if ( is_single() && ! is_admin() ) { return prefix_insert_after_paragraph( $ad_code, 4, $content ); } return $content; } function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) { $closing_p = '</p>'; $paragraphs = explode( $closing_p, $content ); foreach ($paragraphs as $index => $paragraph) { if ( trim( $paragraph ) ) { $paragraphs[$index] .= $closing_p; …
Category: Web

Avoid enormous network payloads

Running a WP site, so asking here. Google speed test shows "Avoid enormous network payloads - Total size was 8,265 KB" (static.doubleclick.net) - 514.2 KB (static.doubleclick.net) - 514.2 KB And several more of doublick that seems pretty huge to me. So Adwords is causing this? Or something in WP configuration?
Category: Web

Advertisement in Loop Posts wordpress

I'm new here I want some help from you in terms of coding in wordpress. The point is that I want to make advertising between items as shown below: <div class="row top-articles"> <?php $args= array( 'posts_per_page'=>4, 'post__not_in'=> $excluded ); $i=0; $otherLoop = new WP_Query( $args ); while ($otherLoop -> have_posts() ) : $otherLoop->the_post();$i++; $cat = get_the_category($post->ID)[0]; array_push($excluded,$post->ID); ?> <div class="small-6 top-story-container columns medium-6 large-3"> <article class="artikulli-<?php echo$cat->slug; ?> live"> <a href="<?php the_permalink();?>"> <div class="img-container"> <div class="inner"> <div class="gradient"></div> <?php if($videos …
Category: Web

Insert ads below the title

I'm creating a plugin for insert ads. I want to insert ad below the title. I'm using the theme MH Magazine Lite Im doing my plugin like this: function diww_pre_content($content) { $pre_content = 'ads_up'; $pre_content .= $content; return $pre_content; } add_filter( 'the_content', 'diww_pre_content' ); But, this shows the ad, below the feature image (inside the post) instead of title. Any idea, how can i do that? Thanks.
Category: Web

Calling shortcode in wp_localize_script strips result

I am working on adding some functionality on a Wordpress plugin which after a certain click needs to call on some shortcode through ajax. What I first attempted was to call the shortcode inside of the ajax processing in my functions.php file: add_action( 'wp_ajax_nopriv_showads', 'showads' ); function showads(){ echo do_shortcode('[myshortcode]'); wp_die(); } Where I would move the output of the shortcode in the response of the ajax call. This shortcode did not execute at all. So instead after some research …
Category: Web

Add Adsense to a website but the server responds with error 510

I'm trying to add Ads to my website. The website is made with Wordpress. I'm going to Options < Adsense < Ad Manager Then I click manage Ads. After that, google starts to analyze my page. After that it shows me places where I can add an ad. If I add one an click save, I get the following error: In English this means: The configuration could not be saved . Your server returned to the request the error code …
Category: Web

Self-serve ad system like Reddit's for Wordpress?

I'm currently building a Wordpress site and I want to implement a sort of "self-serve" ad system into my site similar to the system Reddit is using. Is there any sort of "self-serve" ad system or plugin for Wordpress? If not, would it be possible to build something like this for Wordpress?
Category: Web

Need help targeting a custom post type with conditional tags

I found some code online to create content blocks on my WordPress blog. I use a content block at the bottom of the sidebar of my page for a shopping widget. Here's the relevant code from functions.php: function initialize_content_blocks() { register_post_type('content-block', array( 'labels' => array( 'name' => 'Content Blocks', 'singular_name' => 'Content Block', 'add_new_item' => 'Add New Content Block', 'edit_item' => 'Edit Content Block', 'new_item' => 'New Content Block', 'view_item' => 'View Content Block', 'search_items' => 'Search Content Blocks', 'not_found' …
Category: Web

Ads below footer

A client of mine has ads on his website, which are managed by a CPT. The ads can be pulled in via a widget, hardcoded query and a shortcode. I have an issue that isn't consistent that I'm trying to debug. Sometimes ads show up below the footer and other times they don't (and they shouldn't). The website is responsive and has different ad units for all 3 breakpoints. The site first goes through CloudFlare and then is cached using …
Category: Web

Showing ads after posts in home page

I am using this code for showing ads after one post in the home page. It's working fine. But I want to show an ad after one post and another one ads after 5 post. What will the loop be. Any suggestions? <?php if((have_posts)): ?> <?php $count=0; ?> <?php while(have_posts()): the_post(); ?> <?php $count ?> <?php if($count==2): ?> <div>Ads code here</div> <h2><a href="<?php the_permalink(); ? >" title="<?php the_title(); ?>"><?php. the_title(); ?></a></h2> <?php else: ?> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.