Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter adrianperez

    (@adrianperez)

    Sorry! I didn’t receive the answer notification. When I created or edit a post the json load the new transient content that would be the correct if the plug clean it before, but now it’s not working with the new updates ??

    I modify the code and I founded that is the ‘after_db_upgrade’ that is not firing, when I change it to ‘save_post’ in the add_action( ‘after_db_upgrade’, ‘tc_clear_transients’ ) it works but I would need (and I guess is more correct) to have the cleared trnasient when it changes the DDBB, any ideas where to go?

    Thanks!

    I solved finally this way, I put here if anyone needs it (the code may be not perfect)

    <?
          //Variables
          $currentID = get_the_ID();
          $prevID;
          $nextID;
          $allID = array();
    
          //Create a query
          $theQuery = new WP_Query( 'post_type=post' );
    
          //Create the array with all the ID's
          while ( $theQuery->have_posts() ) {
            $theQuery->the_post();
            array_push($allID, get_the_ID());
          }
    
          //Check lenght of the array
          $allIDlenght = count($allID) - 1;
    
          //Check our actual ID position on the array
          $position = array_search($currentID, $allID);
    
          //If it's in the first position
          if($position === 0){
            $prevID = $allID[$allIDlenght];
            $nextID = $allID[1];
          //If it's in the last one
          }else if($position === $allIDlenght){
            $prevID = $allID[$allIDlenght-1];
            $nextID = $allID[0];
          }else{
            $prevID = $allID[$position-1];
            $nextID = $allID[$position+1];
          }
    ?>

    Hi @marco87x, same problem here, did you find any workaround???

    I have the same doubt! Did you finally could resolve it @rimfya?

    Thanks!

    Thread Starter adrianperez

    (@adrianperez)

    Yes! It’s the first time that I have this problem migrating a wordpress into the same server, thanks for the document, it was very instructive, by chance, if I change all the title the wordpress upload the new post with the correct charset, by the moment ??

    Thanks bcworkz!

    Thread Starter adrianperez

    (@adrianperez)

    I found it!
    The guy who makes the original code told me that the new post could be saved in a different charcter set, I migrate the web just before and when I change a name to any post and save it, it comes to the same charcter set and the new list…so now I have to re-save all posts and they will come to the normality…I hope ??

    Thanks!

    Thread Starter adrianperez

    (@adrianperez)

    Me neither ?? the code posted above it’s the one that you can see in the link, but I didn’t understand anything, cause numbers works fine but new post comes down and didn’t follow the order…

    Really strange…I was thinking that maybe it?s for the query_posts, I read about it and it’s very fragile, will continue working on it, if I found why I will post here the solution.

    On the other hand I think I will remake the code with your solution, again ??

    Thread Starter adrianperez

    (@adrianperez)

    Hi again!
    I can’t believe it, now I have all this working (here the web, https://aristu.com/lista/ ) but when I add a new post or edit one title, it moves to the end of the list. I couldn’t understand, with number it works and order it in the correct places.

    Here’s the code that I finally modify, apparently now I don’t need the code used before to put number last…

    <?php /* Template Name: List all posts */ ?>
    
    <?php get_header(); ?>
    
    	<!-- Section -->
    	<section>
    
    <div id="main-background">
    
       <div id="main-column">
    
          <div class="margin-top"></div>
    
          <div id="a-z">
    
             <?php
             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
             $args = array (
                'posts_per_page' => -1,
                'post_type' => 'post',
                'orderby' => 'title',
                'order' => 'ASC',
                'paged' => $paged,
                'caller_get_posts' => 1
             );
             query_posts($args);
                      if ( have_posts() ) {
                while ( have_posts() ) {
                   the_post();
                   $first_letter = mb_strtoupper(mb_substr(apply_filters('the_title',$post->post_title),0,1,'UTF-8'), 'UTF-8');
    
    				$signos = array("?", "!");
    				if (in_array($first_letter, $signos)) {
                   	$first_letter = mb_strtoupper(mb_substr(apply_filters('the_title',$post->post_title),1,2,'UTF-8'), 'UTF-8');
    				}
    
    			   $acentos = array ("á", "é", "í", "ó", "ú");
    				if (in_array($first_letter, $acentos)) {
    				$first_letter = mb_strtoupper (trim(preg_replace('~[^0-9a-z]+~i', '-', preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($first_letter, ENT_QUOTES, 'UTF-8'))), ' '));
    			   }
    
                   if ($first_letter != $curr_letter) {
                      if (++$post_count > 1) {
                         end_prev_letter();
                      }
                      start_new_letter($first_letter);
                      $curr_letter = $first_letter;
                   }
                   ?>
                   <div class="title-cell"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
                <?php }
                end_prev_letter();
                ?>
             <?php } else {
                echo "<h2>Sorry, no posts were found!</h2>";
             }
             ?>
    
          </div><!-- End id='a-z' -->
    
       </div><!-- End class='margin-top -->
    
    </div><!-- End id='rightcolumn' -->
    
    <?php
    function end_prev_letter() {
       echo "</div><!-- End of letter-group -->\n";
       echo "<div class='clear'></div>\n";
    }
    function start_new_letter($letter) {
       echo "<div class='letter-group'>\n";
       echo "\t<div class='letter-cell'>$letter</div>\n";
       echo "<div class='clear'></div>\n";
    }
    
    ?>
    
    	</section>
    	<!-- /Section -->
    
    <?php get_footer(); ?>
    Thread Starter adrianperez

    (@adrianperez)

    Hi, totally my fault, I put the_excerpt on single page for the meta description and, obviously, it doen’t accept html tags, so the solution was to strip tags in this output and all worked fine (in fact, I don’t need any code cause manual excerpt allow html tags)

    Thanks anyway!

    Thread Starter adrianperez

    (@adrianperez)

    It works like a charm, thanks for your time bcworkz, really, this is your code but pointing to a specific page:

    add_filter('posts_orderby', 'reorder_query', 10, 2);
    function reorder_query($order, $query) {
    	global $wpdb;
    	if ($query->is_page('SLUGOFYOURPAGE')) $order = "{$wpdb->posts}.post_title + 0, {$wpdb->posts}.post_title";
    	return $order;
    }
    Thread Starter adrianperez

    (@adrianperez)

    Thanks bcworkz, really, I spend hours before ask something to the support, most times I arrive searching, but I have no luck with some ones in this site ??

    best!

    Thread Starter adrianperez

    (@adrianperez)

    Thread Starter adrianperez

    (@adrianperez)

    Yep, I try it, but it doesn`t work. I obtain the same result with:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
             $args = array (
                'post_type' => 'post',
                'orderby' => 'title+0, title',
                'order' => 'ASC',
                'paged' => $paged
             );

    Any idea? Thk!

    Thread Starter adrianperez

    (@adrianperez)

    Thanks bcworks for your reply, but in fact I haven’t this problem (but anyway I fix it for the future), the problem it’s that I try to put the numbers last, don’t first, now I have this and I need to have the numbers after the letters ??

    1
    15 M
    8
    80–90 Comunicación
    A
    ADG/FAD Campa?a
    Ausonia Packs
    Ausonia TV
    B
    Balay
    Barcelona 2159
    Biografía del miedo
    Buen viaje Excelencia

    Thread Starter adrianperez

    (@adrianperez)

    I forget, I also try the advanced excerpt plugin and I activated excerpt in pages, but, don’t know why, there html works.

    Any idea?
    Thk.

    [No bumping, thank you.]

Viewing 15 replies - 1 through 15 (of 15 total)