Show another website in iFrame - iframe

I am trying to show a website on iFrame tag, it is working fine only at the landing page and while clicking on any page links it redirects me to the live website. I don't want it to redirect it to the live website. I am using the following code in php.
<iframe src="demo1.php" frameborder="0" >
</iframe>
<?php
$site = array('http://anusha.bluethink.in/b4bstaging/','http://anusha.bluethink.in/b4bstaging/personalised-balls.html');
$i=0;
foreach($site as $n) {
echo file_get_contents($site[$i]);
$i++;
}
?>

Related

Different header template for cms pages

I would like to use two different header templates for a website. One for the home page and in other cms pages the layout will be different. Can anyone please help me out with it?
There are two ways:
1-
<?php if (is_front_page()): ?>
home header codes
<?php endif; ?>
other pages header codes
2- You should have two header files like: header.php & header-home.php :
<?php
if (is_front_page()){
get_header('home');
}
else {
get_header();
}
?>

How can I display ads in amp pages

I added this code to functions.php to perform the operation, but yet ads are not displaying on my amp pages.
//Adding Header Code in AMP pages in WordPress
add_action(‘amp_post_template_head’,’nhb_amp_my_custom_head’);
function nhb_amp_my_custom_head($amp_template) { ?> //adsense_header_code <?php }
//Adding Footer Code in AMP pages in WordPress
add_action(‘amp_post_template_footer’,’nhb_amp_my_custom_footer’);
function nhb_amp_my_custom_footer($amp_template) { ?> //adsense_body_code <?php }
You can display ads on your amp pages using the <amp-ad> or <amp-embed> tags.
A container to display an ad. The amp-embed is an alias to the amp-ad
tag, deriving all of its functionality with a different tag name. Use
amp-embed when semantically more accurate. AMP documents only support
ads/embeds served via HTTPS.
Example: Displaying a few ads
<amp-ad type="a9"
width="300"
height="250"
data-aax_size="300x250"
data-aax_pubname="test123"
data-aax_src="302">
</amp-ad>
<amp-ad width="300"
height="250"
type="industrybrains"
data-width="300"
data-height="250"
data-cid="19626-3798936394">
</amp-ad>
<amp-embed type="taboola"
width="400"
height="300"
layout="responsive"
data-publisher="amp-demo"
data-mode="thumbnails-a"
data-placement="Ads Example"
data-article="auto">
</amp-embed>
For more examples, you can try visiting this link.

No http referer set when non logged in user comes from inner pages to home page

I am trying to load a preloader gif when user comes to the website for first time
I am using this code :
<?php
$find = 'example.com';
echo $referer = $_SERVER['HTTP_REFERER'];
echo $pos = strpos($referer, $find);
if(!$pos):?>
<div id="site-preloader">
<img src="http://www.example.com/wp-content/uploads/2017/07/loader.gif" class="preload-img">
</div>
<?php endif; ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery(window).load(function(){
jQuery('#site-preloader').delay(350).fadeOut('slow',function(){jQuery(this).remove();});
});
});
</script>
This code works absolutely fine when user is logged in .
But when user is not logged in and if user navigates to home page from some inner page or post then the code doesn't work because http_referer is not set
What can be wrong ..
Please help

Wordpress Is there anyway to add specific class to home page body tag?

I am using a theme (Arcade Basic) in which the home page header image is resized differently from all other pages...
I would like to have the same header resizing on all pages included the home..
The resizing script is a .js script I don't want (I can't) to modify .
The resizing is triggered by the presence of the 'page' class in the body tag ..
# HOME PAGE
<body class="home blog only-on-home no-fittext basic">
# OTHER PAGES
<body class="page-template-default page page-id-1183 no-fittext basic">
If there anyway to add the 'page' class on the home page ?
Providing that you are using a specific page to act as your homepage and not just the default list of posts, you can add the following is_home() to check if you're on the homepage then add a class.
More information on the static front page setting.
<?php if ( is_home() ) : ?>
<body class="<?php body_class('homepage'); ?>">
<?php else : ?>
<body class="<?php body_class(); ?>">
<?php endif; ?>
you Can - but I can't say that treating all of your pages like a "page" won't come with bugs.
I would call the class something else.
find this in your header.php
<body <?php body_class('whatEverClassHere'); ?>>

I want to customize the facebook buttons like "2201 Fans" into my website

I want to cutomize the facebook buttons like "2201 Fans" into my website .. but in facebook developer site its like auto generated button .... I'm now working on a wordpress site .... plugin will be more helpful
Display no of fans on your site using facebook page id.
<?php
$page_id = 'yourfbpageid'; // your facebook page id
$xml = #simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot");
$fans = $xml->page->fan_count;
?>
<li class="text white"><span></span><?php echo $fans.' Fans'; ?></li>

Resources