Tutorial: Mostrar Adsense entre artículos en Index de forma sencilla

  • Autor Autor brianerc
  • Fecha de inicio Fecha de inicio
ufff excelente me sirvió a la perfección siguiendo las indicaciones dadas...Muchas gracias...
 
Exelente tutorial me sirvio mucho..:encouragement:

Ese ultimo codigo asi random, me va de maravilla en mi blog: Enlace eliminado

muesto 2 bloques de adsense en random y muestran y desaparecen

gracias este junto el otro tutorial es lo que buscaba

Gracias por el aporte, voy a probarlo..

ufff excelente me sirvió a la perfección siguiendo las indicaciones dadas...Muchas gracias...

No hay por qué! cualquier cosa quedo a las órdenes!
saludos!
Sean felices 🙂
 
Gracias por compartir
 
Excelente tutorial :encouragement: . acabo de implementarlo de esta forma en mi blog :drunk:
 
Muchas gracias por el tutorial.
 
Buenisimo me ha servido el tuto!.. grandioso 😀
 
Justo que empiezo con Adsense esto me ayudara mucho, Gracias 😀
 
PHP:
<?php get_header(); ?>

	<!-- CONTENT -->
	<div id="content">
	
		<?php
			if ( $paged < 2  && of_get_option('gamepress_slider_radio', '1')) : 
			
				if (of_get_option('gamepress_slider_type') == '1'):

					get_template_part( 'includes/nivo_default' ); 

				elseif (of_get_option('gamepress_slider_type') == '2'):

					get_template_part( 'includes/nivo_thumbnails' ); 				

				endif;

			endif;
		?>

		<?php if ( have_posts() ) : ?>
		
		<section id="main-content" role="main">

			<?php if ( $paged < 2  && (of_get_option('gamepress_slider_radio') == '2' || of_get_option('gamepress_slider_radio') == '1')) : ?>
		
			<h2 class="section-header"><?php _e('Latest news', 'gamepress'); ?></h2>
			
			<?php endif; ?>
			
				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php
						
						if (of_get_option('gamepress_hp_layout') == '2'):
							
							get_template_part('content','bigthumb');
												
						elseif (of_get_option('gamepress_hp_layout') == '3') :

							get_template_part('content', 'smallthumb');
							
						else :

							get_template_part('content');
						
						endif;
					?>

				<?php endwhile; ?>

		<?php else : ?>
		
		<section id="main-content" role="main" class="full-height">
		
				<article id="post-0" class="post no-results not-found">
					<header class="entry-header">
						<h1 class="entry-title"><?php _e( 'Nothing Found', 'gamepress' ); ?></h1>
					</header><!-- .entry-header -->

					<div class="entry-content">
						<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'gamepress' ); ?></p>
						<?php get_search_form(); ?>
					</div><!-- .entry-content -->
				</article><!-- #post-0 -->

			<?php endif; ?>
		
		</section>
		<?php
			if(function_exists('wp_pagenavi')) :
				wp_pagenavi(); 
			else :
		?>
			<div class="wp-pagenavi">
				<div class="alignleft"><?php next_posts_link('&laquo; '.__('Older posts','gamepress')) ?></div> 
				<div class="alignright"><?php previous_posts_link(__('Newer posts','gamepress').' &raquo;') ?></div>
			</div>
		<?php endif; ?>
	</div>
	<!-- END CONTENT -->
		
	<?php get_sidebar(); ?>

<?php get_footer(); ?>

Te dejo mi index, no logre sacarlo ... gracias por tu ayuda

- - - Actualizado - - -

me ayudas ? gracias
 
Lo he probado y me ha funcionado perfectamente, muchas gracias.
 
Primero que nada, debemos ubicar donde dice:

PHP:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Una pregunta, en que archivos se encuentran estas linas de código?

- - - Actualizado - - -

Bueno eh intentado ponerlo en mi blog con este theme http://fuutec.com/2012/07/beegee-theme-para-wordpress-optimizado-moderno-y-con-muchas-opciones.html utilizando el notepad++ pero no eh logrado ponerlo...
 
Sigo sin poder solucionarlo... ¿Sera que alguien me dará una mano?
 
Muchas gracias por la ayuda
 
increible aportación, gracias!
 
Gracias por el aporte! aunque solo me aparecio en el segundo post!

Quise intentar el de eleatorio pero nunca me funciono,
Gracias por el aporte!
 
Hola! He intentado realizar las soluciones que proponéis pero mi Index es distinto y nunca me salen los anuncios correctamente. ¿Podrían echarme una mano? Muchas gracias por adelantado
Código PHP Index:
PHP:
 <div id="load_posts_container">



        <?php

        $category_ID = get_category_id('blog');

        $args = array(

                     'post_type' => 'post',

                     'posts_per_page' => 12,

                     'cat' => '-' . $category_ID,

                     'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)

                     );            

        query_posts($args);

        $x = 0;

        

        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

        if($paged > 1) 

          $y = (0 + (($paged-1) * 12));

        else

          $y = 0;

        while (have_posts()) : the_post(); ?>                                                                      

        

            <?php if($x == 2) { ?>

            <div class="home_post_box home_post_box_last" onmouseover="show_post_desc(<?php echo $y; ?>)" onmouseout="hide_post_desc(<?php echo $y; ?>)">

            <?php } else { ?>

            <div class="home_post_box" onmouseover="show_post_desc(<?php echo $y; ?>)" onmouseout="hide_post_desc(<?php echo $y; ?>)">

            <?php } ?>

            

                <!--<img src="<?php bloginfo('stylesheet_directory'); ?>/images/blog-image.jpg" />-->

                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('home-post',array('alt' => 'post image', 'class' => 'rounded')); ?></a>

                

                <div class="home_post_desc" id="home_post_desc<?php echo $y; ?>">

                    <?php $temp_arr_content = explode(" ",substr(strip_tags(get_the_content()),0,225)); $temp_arr_content[count($temp_arr_content)-1] = ""; $display_arr_content = implode(" ",$temp_arr_content); echo $display_arr_content . '...'; ?>

                </div><!--//home_post_desc-->

                

                <div class="home_post_title_cont">

                    <h3><?php the_title(); ?></h3>

                    <h4><?php the_category(', '); ?></h4>

                </div><!--//home_post_title_cont-->

            </div><!--//home_post_box-->

        

            <?php if($x == 2) { $x = -1; /*echo '<div class="clear"></div>';*/ } ?>

        

        <?php $x++; $y++; ?>

        <?php endwhile; ?>        

        <?php wp_reset_query(); ?>        

        

        <div class="clear"></div>

        

        </div><!--//load_posts_container-->

        

        <div class="load_more_cont">

            <p align="center"><span class="load_more_text"><?php next_posts_link('<img src="' . get_bloginfo('stylesheet_directory') . '/images/load-more-image.png" />') ?></span></p>

        </div><!--//load_more_cont-->

        

        

<script type="text/javascript">

// Ajax-fetching "Load more posts"

$('.load_more_cont a').live('click', function(e) {

	e.preventDefault();

	//$(this).addClass('loading').text('Loading...');

        //$('.load_more_text a').html('Loading...');

	$.ajax({

		type: "GET",

		url: $(this).attr('href') + '#main_container',

		dataType: "html",

		success: function(out) {

			result = $(out).find('#load_posts_container .home_post_box');

			nextlink = $(out).find('.load_more_cont a').attr('href');

                        //alert(nextlink);

			//$('#boxes').append(result).masonry('appended', result);

                    $('#load_posts_container').append(result);

			//$('.fetch a').removeClass('loading').text('Load more posts');

                        //$('.load_more_text a').html('Load More');

                        

                        

			if (nextlink != undefined) {

				$('.load_more_cont a').attr('href', nextlink);

			} else {

				$('.load_more_cont').remove();

                                $('#load_posts_container').append('<div class="clear"></div>');

                              //  $('.load_more_cont').css('visibilty','hidden');

			}



                    if (nextlink != undefined) {

                        $.get(nextlink, function(data) {

                          //alert(nextlink);

                          if($(data + ":contains('home_post_box')") != '') {

                            //alert('not found');

                              //                      $('.load_more_cont').remove();

                                                    $('#load_posts_container').append('<div class="clear"></div>');        

                          }

                        });                        

                    }

                        

		}

	});

});

</script>        

        

<?php get_footer(); ?>
 
Este sirve también para poner debajo de las categorías? Yo tengo uno debajo de las categorías pero lo tuve que hacer con el Widget de texto y no me gusta. Aclaro que soy nuevo en esto y no tengo mucho conocimiento en el tema.
 

Temas similares

Atrás
Arriba