• Resolved daniel002

    (@daniel002)


    Hi, in my workflow I use browser-sync with Gulp, normally the permalinks are like this:

    https://localhost:3000/mywebsite/store-item/

    But when I use the Ajax Load More plugin, the permalinks change to:

    https://localhost/mywebsite/store-item/

    Here my shortcode:
    <?php echo do_shortcode(‘[ajax_load_more repeater=”template_1″ post_type=”mic_store” posts_per_page=”10″ transition_speed=”500″ scroll=”true” transition=”fade” transition_container=”false” button_label=”Ver Más” button_loading_label=”Cargando…”]’); ?>

    It seems that exist a conflict with the plugin and browser-sync.

    Thanks for any advice!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @daniel002,
    Not sure these Browser Sync issues have anything to do with Ajax Load More.

    Are you saying the_permalink() is stripping :3000 from the url only when used with repeater templates?

    Is there any other specific reasons you think the plugin could be causing your issues?

    Cheers,

    Thread Starter daniel002

    (@daniel002)

    Hi,

    If I replace the shortcode of the plugin with the original code that I wrote the browser-sync reload functionality works totally fine (https://localhost:3000 appears again), so it seems there is a kind of incompatibility.

    By the way, I am using the Ajax Load More – Repeater Templates paid plugin, I put my code in the fields of the plugin admin panel.

    Plugin Author Darren Cooney

    (@dcooney)

    Hi Daniel,
    Can you share your repeater template?

    Cheers,

    Thread Starter daniel002

    (@daniel002)

    Of course:

    <div class="row flexbox-centrado-y flexbox-responsiveTop768 poemas-contenido">
    	<!-- Izq -->
    	<div class="col-lg-5 col-md-5 col-sm-4 flexbox-centrado-y contenido-nombre">
    		<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
    	</div>
    
    	<!-- Der -->
    	<div class="col-lg-7 col-md-7 col-sm-8 contenido-texto">
    		<ul>
    			<?php
    				$args_poema = array(
    					'post_type'       => 'ubd_ingrediente',
    					'posts_per_page'  => -1,
    					'orderby'         => 'date',
    					'order'           => 'DESC',
    					'meta_query'		  => array(
    						array(
    							'key' => 'autor_poema',
    							'value' => get_the_ID()
    						)
    					)
    				);
    
    				$obj_poema = new WP_Query($args_poema);
    			?>
    			<?php if($obj_poema->have_posts()) : while($obj_poema->have_posts()) : $obj_poema->the_post(); ?>
    			<li>
    				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    				<span>
    					<?php get_template_part('modulos/reproductor', 'poemas'); ?>
    					<?php $lector = get_field('nombre_lector'); ?>
    					<?php if(!empty($lector)) { ?>
    					<?php echo get_the_title($lector); ?>
    					<?php } ?>
    				</span>
    			</li>
    
    		<?php endwhile; endif; ?>
    		<?php wp_reset_postdata(); ?>
    
    		</ul>
    	</div>
    </div>

    And the shortcode:

    <?php echo do_shortcode('[ajax_load_more repeater="template_1" post_type="ubd_proyecto" posts_per_page="10" transition_speed="500" scroll="true" transition="fade" transition_container="false" button_label="Ver Más" button_loading_label="Cargando..."]'); ?>

    Thanks!

    Plugin Author Darren Cooney

    (@dcooney)

    Hey Daniel,
    Thanks, it looks fine – I’m honestly not sure…
    I haven’t tested with Browser Sync before. it’s strange that the_permalink would be removing the :3000only in the repeater template.

    Are both the h3 link and the nested query links incorrect?

    Thread Starter daniel002

    (@daniel002)

    Hi,
    Yes, both links remove the :3000 of the url
    Besides, all the other permalinks where I’m not using the plugin are working fine.
    Maybe you should test the plugin with Gulp + Browser Sync,

    Thanks for the help!

    Plugin Author Darren Cooney

    (@dcooney)

    Maybe you should test the plugin with Gulp + Browser Sync,

    I’ll add this to my list if I get some time.

    Marking as resolved for now, if you end up figure this out i’d appreciate it if you could post back here.

    Cheers,

    I’m experiencing this same issue. I use DesktopServer to deal with my local development installations, and map domains to them.

    What’s happening here for example is:
    – local install domain set as https://www.example.dev/
    – theme is built off of Sage by roots.io and running with gulp and browsersync set up so that as I make changes, in my browser the site is running from https://localhost:3000/ and automatically refreshes as changes are made
    – when running via browsersync anywhere I use the_permalink() it replaces localhost:3000/ with https://www.example.dev/

    Couldn’t figure out why my browser stopped refreshing when I was trying to make edits to the alm templates until I finally noticed that when I clicked on links that were from the alm templates, it was replacing the URL.

    Not a huge issue since it only affects local development, but will still be great to have it fixed if possible.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error with the_permalink() using browser-sync with Gulp in localhost’ is closed to new replies.