Cara Memasang Iklan Adsense di Template Darko Wallpaper Versi Mas Pingi

1. Masuk ke file manager (PERHATIAN! untuk theme darko hanya bisa di edit melalui file manager saja).

2. Lalu masuk ke direktori = nama domain > wp-content > themes > darko > buka content. Lalu langsung saja ganti seluruh kodenya menjadi berikut ini:

<?php
/**
 * The default template for displaying content. Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage wallpin
 * @since wallpin 1.0
 */
global $smof_data;
?>

<article id="post-<?php the_ID(); ?>" <?php post_class();?>>
<?php $classes = get_post_class();
//print_r($classes);
?>
<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
<div class="featured-post">
<?php _e( 'Featured post', 'quantum' ); ?>
</div>
<?php endif; ?>
<?php if (is_home() OR is_archive() OR is_search()):?>
<div class="entry-content">
<div class="home-thumb">
<?php //the_post_thumbnail('full');
if ($smof_data['home_layout']=="styletwo") {
$homeimg_size = "medium";
}
elseif ($smof_data['home_layout']=="twocoloumn") {
$homeimg_size = "medium"; }
else {
$homeimg_size = "full";
}
?>
<a href="<?php the_permalink();?>">
<?php $att_gbr_link = wp_get_attachment_image_src(get_post_thumbnail_id(), $homeimg_size); ?>
<img itemprop="image" width ="<?php echo $att_gbr_link[1];?>" height="<?php echo $att_gbr_link[2];?>" src="<?php echo $att_gbr_link[0]; ?>"  title="<?php the_title_attribute(); ?>"  alt="<?php the_title(); ?>">
</a>
</div>
<header class="entry-header cf">
<span class="cat-meta"><i class="icon-folder-open"></i><span><?php $category = get_the_category();
echo $category[0]->cat_name; ?></span>
</span>
<h2 class="entry-title"  itemprop="name">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'quantum' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>
<div class="post-meta">
<span itemprop="author"><i style="margin-left:0px" class="icon-pencil"></i><?php the_author();?></span>
<span itemprop="publisher" style="display:none;"><?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?></span>
<span itemprop="datePublished"><i class="icon-time"></i><?php the_time('F j, Y');?></span>
<span itemprop="dateModified" style="display:none;"><i class="icon-time"></i><?php the_time('F j, Y');?></span>
<?php if (function_exists('the_views')):?>
<span>
<i class="icon-eye-open"></i>
<?php the_views();
endif;?></span>
</div>
</header><!-- .entry-header -->

<div class="home-excerpt post-body">
<?php quantum_excerpt(25);?>
</div>
<?php get_template_part('content','loopgallery');?>
</div><!-- .entry-content --> </article/>
<?php else:
// start single content ?>
<article id="post-<?php the_ID(); ?>" <?php post_class();?>itemscope itemtype="http://schema.org/BlogPosting">
<meta itemscope itemprop="mainEntityOfPage"  itemType="https://schema.org/WebPage" itemid="<?php the_permalink();?>"/>
<div class="entry-content"> <header class="entry-header cf">
<h1 class="entry-title" itemprop="headline">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'quantum' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<div class="post-meta">
<span class="posted-by"><?php _ex('By', 'Post Meta', 'quantum'); ?>
<span class="author vcard post-author reviewer" itemprop="author" itemscope itemtype="https://schema.org/Person"><span itemprop="name"><?php the_author_posts_link(); ?></span></span>
</span>
<span itemprop="publisher" itemscope itemtype="https://schema.org/Organization">
    <span itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
    <img src="<?php echo $smof_data['custom_fav']; ?>" style="display:none"/>
      <meta itemprop="url" content="<?php echo $smof_data['custom_fav']; ?>">
      <meta itemprop="width" content="16">
      <meta itemprop="height" content="16">
    </span>
    <meta itemprop="name" content="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
  </span>

<span class="posted-on" style="margin-right:5px;"><?php _ex('on', 'Post Meta', 'quantum'); ?>
<span class="dtreviewed">
<time class="value-datetime" datetime="<?php echo esc_attr(get_the_time('c')); ?>" itemprop="datePublished"><?php echo esc_html(get_the_date()); ?></time>
</span>
<span itemprop="dateModified" style="display:none;"><i class="icon-time"></i><?php the_time('F j, Y');?></span>
</span>
<span><?php _e(' | ','quantum');?></span>
<?php if (function_exists('the_views')):?>
<span class="the-views"><i class="icon-eye-open"></i>
<?php the_views();
endif;?>
</span>
<span class="cat-meta" style="margin-left:10px;"><i class="icon-folder-open"></i><?php $category = get_the_category();
echo $category[0]->cat_name; ?>
</span>
<?php include('includes/rating-snippet.php');?>
</div>
</header><!-- .entry-header -->
<?php if($smof_data['single_ads']==1 && $smof_data['single_ads_code']!=''): ?>
<?php echo $smof_data['single_ads_code']; ?>
<?php endif; ?>
<div class="single-content post-body description " itemprop="articleBody">
<?php if ($smof_data['single_autodesc']==1 && $smof_data['top_single_auto']==1) {
echo do_shortcode($smof_data['top_single_auto_code']);
} ?>
<div class="single-thumb" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsif -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxx"
     data-ad-slot="xxxxx"
     data-ad-format="link"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script> </div>
<?php if($smof_data['single_ads']==1 && $smof_data['single_ads_code2']!=''): ?>
<?php echo $smof_data['single_ads_code2']; ?>
<?php endif; ?>
<div class="entry-content" itemprop="articleSection">
<?php the_content(); ?>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsif -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxx"
     data-ad-slot="xxxxx"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php if ($smof_data['single_autodesc']==1 && $smof_data['bottom_single_auto']==1) {
echo do_shortcode($smof_data['bottom_single_auto_code']);
} ?>
<?php get_template_part('content','loopgallery');?>
</div>
<span class="the-tags"><?php the_tags('<span class="bold-tags">Tags: </span>',' ', '<br />'); ?> </span>
<?php include('includes/social-share.php');?>
<?php if($smof_data['single_ads']==1 && $smof_data['single_ads_code3']!=''): ?>
<?php echo $smof_data['single_ads_code3']; ?>
<?php endif; ?>
</div><!-- .entry-content -->
<?php endif;?>
</article><!-- #post -->
NB: Ganti kode xxxxx dengan ca-pub punya sendiri.

3. Untuk settingan di plugin semi wallpaper. Seperti biasa. Yaitu:

a. Masuk ke Custumizer Appearance > Customize > Semi Wallpaper >

Untuk single post page =

1st Image = Top Content
2nd Image = After 2nd Paragraph
1st Adsense = Top Content lalu masukkan kode iklan responsif
2st Adsense - After 2nd Paragraph lalu masukkan kode iklan responsif

4. Untuk settingan ads di attachment, masuk kesini: masuk ke /wp-admin/themes.php?page=optionsframework
lalu aktivkan iklan attachment.

SELESAI

0 Response to "Cara Memasang Iklan Adsense di Template Darko Wallpaper Versi Mas Pingi"

Posting Komentar