google

  • Redirect AMP url to Non-AMP url in Nginx

    ·

    AMP (Accelerated Mobile Pages) can be used for any site to load the content faster. We have shared a tutorial: How to Enable AMP in WordPress site. If you no longer wish to use the AMP functionality you can disable it. But there are many posts which have already been indexed by google search engine as AMP version will no longer work resulting a 404 error or “Page Not found” error. To solve the problem all you need is to redirect all those links to a non-amp version.

    Add the following code inside virtual server block in nginx:-

    location ~ /amp/$ {
    rewrite ^(.*/)amp/$ $1 permanent;
    }

    The above will redirect all urls having /amp/ at the end to the non amp version of the url e.g.

    https://wbxpress.net/display-post-modified-date-genesis-theme/amp/

    will be redirected to

    https://wbxpress.net/display-post-modified-date-genesis-theme/

    That’s it. Now your site will be free from 404 error.

  • New Genesis Sample Theme – A Fresh Update

    ·

    With Genesis 2.6, Genesis Sample theme got better than ever before. Genesis is now Google Adsense ready. It means you don’t have to worry about placing ads in your site. You just enable Google auto adsense and it will do the rest. Genesis Sample theme now looks better because the fonts are smaller in size and soothing for eyes.

     

     

    Check demo.

  • Accelerated Mobile Pages in WordPress

    ·

    Accelerated Mobile Pages (AMP) is a Google backed project for faster delivery of your website content to the mobile device users. Google search engine also marks such websites with a symbol (a lighting symbol).

    To know more about the project AMP visit: https://www.ampproject.org/

    Implementing AMP for wordpress site is super easy. You need to install AMP plugin.

    After installation of the plugin append url of any post with /amp to check the mobile version of the content.

    Normal example URL: https://wbxpress.net/favorite-wordpress-plugins/
    AMP version url: https://wbxpress.net/favorite-wordpress-plugins/amp/

    Now, there are certain things you may wish to customize.

    1. Customize the footer area:

    =>


    To remove the credit link, open \plugins\amp\templates\footer.php and remove the following selected code (line 4 to 6).

    Next open \plugins\amp\templates\style.php and remove the following selected code (line 361 to 366).

    Also change the margin

    .amp-wp-footer h2 {
    	font-size: 1em;
    	line-height: 1.375em;
    	margin: 0; // change to 0
    }
    

    2. Change Categories and Tags texts

    Open \plugins\amp\templates\meta-taxonomy.php and change the texts (line 4 and 17).

    3. Remove Author and Date Meta of Posts

    Open \plugins\amp\templates\single.php and remove line 21 as shown:

    4. Insert Google Adsense below Post Title and above the Content

    To add the adsense code below post title and above the post content, open theme functions.php file and add the following code:-

    /**
     * Add the AMP Ad script to AMP pages.
     */
    function isa_load_amp_adsense_script( $data ) {
        $data['amp_component_scripts']['amp-ad'] = 'https://cdn.ampproject.org/v0/amp-ad-0.1.js';
        return $data;
    }
    add_filter( 'amp_post_template_data', 'isa_load_amp_adsense_script' );
    
    /**
     * Add Google Adsense code to AMP above the content
     */
    add_action( 'pre_amp_render_post', 'isa_amp_add_content_filter' );
     
    function isa_amp_add_content_filter() {
        add_filter( 'the_content', 'isa_amp_adsense_above_content' );
    }
     
    function isa_amp_adsense_above_content( $content ) {
     
        $publisher_id = 'ca-pub-9114389529631234';
     
        $ad_slot = '5506321234';
     
        // Add Adsense ad above AMP content
        $ad_code = '';
     
        return $ad_code . $content;
    }
    

    Change the publisher id and ad slot with your own.

    That’s it.

    Troubleshooting: Google structured data testing tool reports the following error.

    1. A value for the logo field is required.

    You need to select a logo from theme customize option.

    2. A value for the image field is required.

    Posts having no featured image will show such an error. In that case you need to select a default featured image for the posts having no featured image set. For this install this plugin: Default Featured Image

  • Similar Posts powered by Google Adsense

    ·

    Google Adsense

    Google Adsense is the best moneytization tool for Online Publishers. Getting approval for Adsense account from Google is very hard. You need to satisfy certain criteria and you must follow rules and regulations to continue using adsense.

    In the month of July, 2016, Google congratulated us for being adsense account holder for 10 years. And we have not violated a single rule of Google Adsense.

    New Adtype – Matched Content

    At present, there are two types of ads that can appear on your pages: text ads and display ads. But recently, Google announced a new type of ad. It is “Google Matched Content”. Every single site can not use this new product. We are chosen to use this feature very recently. And here we are showing the pageviews from which you can assess the minimum required criteria for eligibility to use Matched Content.

    page-views
    What is Google Matched Content?

    One goal of Matched content is to increase user engagement. Your page RPM and other metrics might be affected by this increase.

    It is like showing similar posts below the content of your website. You can use instead of related post plugin or in combination with the same. The only purpose is to increase user engagement, which results increased revenue. At present it is in beta. It is also not counted towards adsense limit quota.

    matched-content

    Matched content units don’t count towards your Google content ad limit per page.

    Are you using this new feature? Your feedback is highly appreciated.

  • How to Use Google Font in Genesis theme

    ·

    Google Fonts are being used recently. Genesis theme also uses Google Fonts in their themes. In this tutorial we like to share how to change the default google font in any genesis child theme.

    Lets take eleven40-pro for an example.

    1. Check which fonts are used.

    Open functions.php of the theme file. You will find this line of code:

    wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lora:400,700|Oswald:400', array(), PARENT_THEME_VERSION );

    With the above line the theme imports two google fonts for use. “Lora” for body text and “Oswald” for title text. We will show how to use different fonts rather than “Lora” and “Oswald”.

    2. Choose Fonts from Google Font Library

    There are hundreds of free fonts available in Google Font Library. You can choose any fonts from this library. Suppose we like to use “Montserrat” and “Neuton” fonts for body text and title respectively.

    3. Change Fonts in functions.php

    So you need to change the code in functions.php as follows:

    wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Montserrat:400,700|Neuton:400,700', array(), PARENT_THEME_VERSION );

    4. Change in style.css also

    You also need to change in style.css. Replace all occurrences of “Lora” to “Montserrat” and “Oswald” to “Neuton”.

    That’s it. You may further change font-size as per your liking.

    If you have any question or suggestion you are most welcome to comment.

    P.S. For editing theme files we strongly recommend to use Notepad++ software.

  • Adding Google Adsense Code in Genesis theme is very easy by using Simple Hook Plugin. Using this plugin one can insert adsense almost anywhere e.g. before or after of header, footer, post title, post content, post info, comment-box, sidebar etc.

    But what if you wish to add adsense in home page in between posts, for example, after each second post or third post. Simple hook plugin can not solve this.

    You need to create a widget area by editing your theme’s functions.php

    Add the following code inside functions.php

    You need to also add the following code in style.css for styling purpose

    .wbxp-google-ads {
    	text-align: center;
    	margin-top: 20px;
    	margin-bottom: 20px;
    }

    Now you should see a widget in your theme Appearance->Widgets

    between-post-area-widget

    Add a Text Box in this widget and paste your Google Adsense code inside it. Now you should see adsense displayed in your home page after each second post. If you wish to add adsense after each third post, just change the value to 3

    $loop_counter == 3