Skip to main content

Posts

Showing posts from August, 2020

Inbuilt PHP functions for Wordpress - Basic Wordpress Theme Development

while(have_posts()) {} This in built function of php runs the following program we have posts. But 1 concept in not clear yet. This while loop will run n number of times or if we don't use or fetch the post using while loop then will the loop go infinite times? To understand this we must be clear of the for loop If we use the_post(); function of wordpress then only we can make the loop finite.  Make sure to use the_post();  to fetch the post and this is important to finish the loop. Else the while loop will go infinite. Example of correct loop  : <?php while ( have_posts () ){      the_post ();      echo " hello " ; } ? > The above loop will print hello = no. of posts. Example of incorrect loop : <?php while ( have_posts () ){      echo " hello " ; } ? > The above loop will print  hello  infinite no. of times. the_title(); The php function fetches the title of the blogpos

[SOLVED] An AMP component 'script' tag is present, but unused - Search Console issue for wordpress website

I Encounter this issue " An AMP component 'script' tag is present, but unused." in my search console for a wordpress website.  I was using "Newspaper 9" wordpress theme with AMP enabled with the help of plugin provided by NEWSPAPER THEME. Everything was going good until i got this error. An AMP component 'script' tag is present, but unused. It was clear the error was due to a change in my website code. I recently got Adsense approval for my website and it was pretty clear that it was due to " AMP ADS ".  I think that my website was adsense approved a few days ago and this could be the reason that AMP-ADS were not setup properly. I used GOOGLE SITE KIT to implement Auto Ads as well as inserting the Ad-code for Adsense approval.  How I solved This Issue I tried many ways to implement amp-ads with the help of AMP Plugin provided by newspaper, Google Site kit. I also tried many Amp settings in my Adsense Dashboard. Luc

Access or select tags, items, div, class, id, etc using xpaths | Scrapping Guide

When we learn web scraping or web automation its very important to understand the concepts of "XPATHS" and using them to get most benefit.  You would be surprised to know that XPATHS Version 1 was created in 1999 and since then we have many version of xpaths and many more to come. But current browsers only support XPATHS Version 1 . Learning XPATH is really easy as well interesting.  Now I will tell you about the structure of XPATHS in rest of the Blogpost Structure of XPATHS   There no need to go deep inside XPATHS if you primarily want to learn web scraping or web automation but remember these two points given below to make your life easier. Remember that a XPATH always start with two forward slash "//"  After 2 Forward slash comes the element name such as "p", "div", etc. Example of XPATH: Here are 3 examples which will facilitate the learning of XPATH and will make the stuff as easy as a loaf of bread. Example