Skip Navigation

[Resolved] Conditional output display shortcode instead of content (navigation pages)

This thread is resolved. Here is a description of the problem and solution.

Problem: When I place pagination shortcodes inside a conditional, the shortcodes are written out in the page content instead of the pagination markup.

Solution: There is a known issue with long conditional content in certain versions of PHP. Here are 3 possible workarounds:
1. Break your content up into multiple conditionals
2. Add the following line to your wp-config.php file:

ini_set('pcre.jit', false);

3. Add the following line to your php.ini file (you may need your host's assistance for this):

pcre.jit= 0

Relevant Documentation:
https://toolset.com/errata/shortcodes-in-conditionally-displayed-content-may-not-be-executed-on-the-front-end/

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 2.48 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Jaime 4 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1470845
Captura de pantalla 2020-01-21 a las 11.22.41.png

I am trying to:
I asked for help to hide results until a search is triggered.
Nigel helped me and we reach it as it can be seen on this ticket.
https://toolset.com/forums/topic/hide-results-from-a-search-before-user-search-but-not-show-no-items-message/

We worked on a testing site (which is exactly the same as my developing site) and it worked perfectly.
But when I insert de code on my developing site it's not working fine because if I insert the pagination controls inside the conditional, it displays the shortcode, not the pagination. (I attached a screenshot)

The code I have is this, and the pagination giving problems is just below </wpv-loop>

[wpv-layout-start]
    [wpv-items-found]

<div class="container">
  <div class="col-sm-8"></div>
  <div class="col-sm-4">
  <div class="panel panel-default  panel-select">
    <div class="panel panel-body ">
    
    <center> <h6>[wpml-string context="wpv-views"]Ordenar por - [/wpml-string] [wpv-sort-orderby type="select" options="post_title,post_date,field-provincia-guia-produccion" label_for_post_title="Nombre" label_for_post_date="Más recientes" label_for_field-provincia-guia-produccion="Provincia" orderby_ascending_for="post_title,post_date,field-provincia-guia-produccion"]</h6></center>
    </div>

    </div>
  </div>
</div>
<br>

    <!-- wpv-loop-start -->
              [wpv-conditional if="( '[wpv-search-term param='wpv_sort_orderby']' ne '' )"]

		<wpv-loop>

<div class="container">  
  <div class="panel panel-primary">
     <div class="panel-heading">
         <h3 class="panel-title" data-toggle="collapse" href="#collapse-[wpv-post-id]" aria-expanded="false" aria-controls="collapse-[wpv-post-id]" style="color:white">
  [wpv-post-title]<span class="panel-title pull-right label-panel hidden-xs">[types field='provincia-guia-produccion'][/types]</span></h3>         </div> 
   <div class="collapse" id="collapse-[wpv-post-id]">
   <div class="panel-body">
    <!-- el contenido del body se inserta aquí, no en la plantilla!!!  -->
 	<div class="row">
      	<div class="panel panel-ficha">
          <center>
            <h3> [types field='persona-de-contacto-guia-produccion'][/types]</h3>
            <h5> <span class="label label-profesional">[types field='tipo-de-empresa'][/types]</span> </h5>

            <h5> <span class="label label-categoria">[wpv-post-taxonomy type="categoria-guia-produccion" format="name" separator="</span> <span class='label label-categoria'>"]</span> </h5>
                      <hr>

          [types field='ubicacion-guia-produccion'][/types]<br>
          [types field='poblacion-guia-produccion'][/types] ([types field='provincia-guia-produccion'][/types])<br>
          [types field='telefono-guia-produccion'][/types]<br>
          [types field='email-guia-produccion'][/types]<br>
          [types field='web-guia-produccion'][/types]   
        
          </center>
          <div class="row"> 
            <div class="col-md-12 col-rrss">   
              <center>
         [wpv-conditional if="( NOT(empty($(wpcf-facebook-guiaprod))) )"]<a href="[types field='facebook-guiaprod' output='raw' target="_blank"][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-facebook-square"></i></span>
              </a>[/wpv-conditional]
         [wpv-conditional if="( NOT(empty($(wpcf-twitter-guiaprod))) )"]<a href="[types field='twitter-guiaprod' output='raw'][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-twitter-square"></i></span>
</a>[/wpv-conditional]   
         [wpv-conditional if="( NOT(empty($(wpcf-instagram-guiaprod))) )"]<a href="[types field='instagram-guiaprod' output='raw' target="_blank"][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-instagram"></i></span></a>[/wpv-conditional]
         [wpv-conditional if="( NOT(empty($(wpcf-youtube-guiaprod))) )"]<a href="[types field='youtube-guiaprod' output='raw' target="_blank"][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-youtube"></i></span></a>[/wpv-conditional]
         [wpv-conditional if="( NOT(empty($(wpcf-vimeo-guiaprod))) )"]<a href="[types field='vimeo-guiaprod' output='raw' target="_blank"][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-vimeo"></i></span></a>[/wpv-conditional]
         [wpv-conditional if="( NOT(empty($(wpcf-linkedin-guiaprod))) )"]<a href="[types field='linkedin-guiaprod' output='raw' target="_blank"][/types]"><span style="font-size: 30px; color: Dodgerblue;"> 
              <i class="fab fa-linkedin"></i></span></a>[/wpv-conditional]
              </center>
            </div>
          </div>
    
        </div>
      </div>
            <div class="row">
<hr>
              <div class="row-view">

                <div class="col-sm-12">
                  [wpv-view name="listado-trabajos-guia-produccion-vista-para-visitantes-listado-horizontal"]
</div> 
              </div>
             
      </div>
          <!-- llega hasta aquí  -->
        </div>
      </div>
  </div>
</div>
<br>
</wpv-loop>
  <div class="pagination">[wpv-pager-nav-links output="bootstrap"]</div> 

  [/wpv-conditional]

    <!-- wpv-loop-end -->
    [/wpv-items-found]

[wpv-layout-end]
<br> 
   
[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]<center>Lo sentimos, no hemos encontrado ninguna empresa con las características que buscas.<br> Estamos actualizando la base de datos de la Guía de producción, por lo que te recomendamos que nos escribas a info@andaluciafilm.com y estaremos encantados de ayudarte a encontrar la empresa que buscas.</center>[/wpml-string]</strong>
	[/wpv-no-items-found]


Thanks a lot!
🙂

#1471925

Hello, if the pagination works correctly when you place the shortcode outside the conditional shortcodes, then you may be experiencing into a known issue with conditionals containing a large amount of content: https://toolset.com/errata/shortcodes-in-conditionally-displayed-content-may-not-be-executed-on-the-front-end/

In this case, you can try these workarounds:
1. Break your content up into multiple conditionals
2. Add the following line to your wp-config.php file:

ini_set('pcre.jit', false);

3. Add the following line to your php.ini file (you may need your host's assistance for this):

pcre.jit= 0
#1480663

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.