Search Results Page
-
I have no trouble placing an ad at the top of a Search Results page (only on Search Pages). It would be nice to know if it’s possible to show 3 ads one at the top and 2 more after every 2nd or 3rd search result.
I’m guessing you would say to put the php function in the search.php template. I tried putting:
<?php if (function_exists ('adinserter')) echo adinserter (2); ?>
into various areas of my search.php file but with no ad display results achieved.
`// Prevent direct script access
if ( !defined(‘ABSPATH’) )
die ( ‘No direct script access allowed’ );
?>
<?php get_header(); ?><div id=”primary”>
<div id=”content” role=”main”><header class=”page-header”>
<div class=”g1-hgroup”>
<h1 class=”page-title”><?php printf( __( ‘Phrase: %s’, ‘g1_theme’ ), ‘<span>’ . get_search_query() . ‘</span>’ ); ?></h1>
<h3 class=”page-subtitle”><?php echo __( ‘Search Results’, ‘g1_theme’ ); ?></h3>
</div></header>
<?php if ( have_posts() ) : ?>
<ul class=”search-results”>
<?php while( have_posts() ): the_post(); ?>-
<p class=”meta search-meta”>
<?php
$obj = get_post_type_object(get_post_type());
echo $obj->labels->singular_name;
?>
</p>
<h3 class=”search-title”>” title=”<?php printf( esc_attr(__(‘Permalink to %s’, ‘g1_theme’) ), the_title_attribute( ‘echo=0’ ) ); ?>” rel=”bookmark”><?php the_title(); ?></h3>
<div class=”search-summary”>
<?php the_post_thumbnail(array(300,200), array(‘class’ => ‘alignleft’)); ?>
<?php the_excerpt(); ?>
“><span style=”color: #ff6600;”>Click here to open File</span>
</div>
<?php endwhile; ?>
<?php
$g1_pagination = G1_Pagination();
$g1_pagination->render();
?>
<?php else: ?>
<?php get_template_part( ‘template-parts/g1_no_results’, ‘search’ ); ?>
<?php endif; ?></div><!– #content –>
</div><!– #primary –><?php get_footer(); ?>
-
<p class=”meta search-meta”>
- The topic ‘Search Results Page’ is closed to new replies.