• Resolved Toni Carvalho

    (@padawantoni)


    Hello!

    I’m trying to implement the button on my search page. But the button appears gray without action.

    Below I leave the code of the page in question with the implemented button. (it has some comments that I still need to remove..)

    <?php
    /**
     * Template Name: Search Page
     *
     * @package WordPress
     * @subpackage playboy-brasil
     *
    */
    get_header();
    
    global $query_string;
    
    $query_args = explode("&", $query_string);
    $search_query = array();
    
    if( strlen($query_string) > 0 ) {
    	foreach($query_args as $key => $string) {
    		$query_split = explode("=", $string);
    		$search_query[$query_split[0]] = urldecode($query_split[1]);
    	} // foreach
    } //if
    
    $search = new WP_Query($search_query);
    $results_count = $wp_query->found_posts;
    
    ?>
    
    <main id="main" class="site-main search" role="main">
    	<header class="compact">
    		<div class="row spacer"></div>
    		<div class="row">
    			<div class="row center-xs white">
    				<div class="container">
    					<h2 class="col-xs-12">
    						<?php echo $results_count; ?> RESULTADOS PARA:
    					</h2>
    				</div>
    			</div>
    			<div class="row center-xs white">
    				<div class="container">
    					<h1 class="col-xs-12">
    						<?php the_search_query(); ?>
    					</h1>
    				</div>
    			</div>
    		</div>
    	</header>
    		<div class="corpo-geral busca">
    	<?php // Start the loop.
    		if( $search->have_posts() ):
    			while( $search->have_posts() ) : $search->the_post();
    				?>
    				<?php include( locate_template( 'page-templates/content-posts-template-xxg.php' ) ); ?>
    				<?php
    			endwhile;
    		endif;
    		?>
    	</div>
    	<div class="row center-xs">
    			<div class="col-md-4 col-xs-10">
    				<!-- <a class="btn outline font-24" href="#">Carregar mais resultados</a> -->
                    <!-- Ajax Load WordPress button -->
                    <?php echo do_shortcode('[ajax_load_more post_type="post, page, portfolio" search="'. $search_query .'" orderby="date" posts_per_page="4" scroll="true" css_classes="plain-text" button_label="Carregar mais resultados"]');
                    ?>
    			</div>
    		</div>
    </main>
    
    <?php //get_template_part('page-templates/content-top5'); ?>
    <?php //get_template_part('page-templates/content-pbshop'); ?>
    
    <?php
    get_footer();
    ?>

    I had made a button and it was working, but the staff who handled the writing of the website created a parent category that included several existing categories.

    So before I had:

    – cat1 > post, post, post
    – cat2 > post, post, post
    – cat3 > post, post, post
    so on…

    And now I have:

    – parentcat1 > cat1 (with posts), cat2 (with posts), so on …

    Any ideas?
    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Button off, no action.’ is closed to new replies.