Forum Replies Created

Viewing 15 replies - 1 through 15 (of 78 total)
  • It’s more of a wordpress question

    I usually simply use WP_Query on post meta and stay in the wordpress logics.

    Here an example of what can be placed on your archive.php template
    /my-custom-type/?archive=archive will reverse order based on a date in a pods field datetime_utc

    <?php
    
    add_action('pre_get_posts', 'custom_archive_filter');
    function custom_archive_filter($query) {
      if (
        !is_admin() &&
        $query->is_main_query() &&
        $query->is_post_type_archive('my-custom-type')
      ) {
        $is_archive = ($_GET['archive'] ?? '') === 'archive';
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    
        $metaQuery = ['relation' => 'AND'];
        $metaQuery[] = [
          'key'     => 'datetime_utc',
          'type'    => 'CHAR',
          'compare' => $is_archive ? '<' : '>=',
          'value'   => gmdate('Y-m-d H:i', time()),
        ];
        $query->set('meta_query', $metaQuery);
    
        $query->set('orderby', 'meta_value');
        $query->set('meta_key', 'datetime_utc');
    
        $query->set('order', $is_archive ? 'DESC' : 'ASC');
      }
    
      return $query;
    }
    Thread Starter cantoute

    (@cantoute)

    Here a snippet of how I did it, adding it somewhere like single-post.php I let the crawlers do the job ??

    <?php
    
    $pod = pods('post', get_the_ID());
    
    $fields = $pod->fields();
    $r = [];
    foreach ($fields as $k => $v) {
      $type = $pod->fields($k, 'pick_object');
      if (
        $type === 'post_type'
      ) {
        $ids = $pod->field($k . '.ID');
        $r[$k] = $ids;
      }
    }
    
    $pod->save($r);

    Here Pods reads the relations from dedicated table (if you configured pods to use a table) and when it saves, it creates/syncs the matching post meta.

    Thread Starter cantoute

    (@cantoute)

    Hi,

    Thanks for your reply and yes, this did the trick.

    Thank you

    Thread Starter cantoute

    (@cantoute)

    Thank you ??

    Thread Starter cantoute

    (@cantoute)

    looks like I need an update LOL

    Thread Starter cantoute

    (@cantoute)

    So I just discovered the new menu in ACF where we can individually select how wp-Typography deals with text fields.

    I noticed it would default as “Treat as Title”
    This could be dangerous on complex setups.

    Just a thought, perhaps default to ‘no filter’ would be safer and for backwards compatibility (and saving me manually selecting every field to be ‘no filter’)

    Thread Starter cantoute

    (@cantoute)

    @pepe thank you so much for your quick reactivity.

    I’ve tried out 5.9.1-beta.1 and it seams you have nailed my issue.

    Very well done.
    Thank you <3

    Thread Starter cantoute

    (@cantoute)

    reactivated the wp-Typography just to catch error log

    not sure it’s valuable data for you…
    so sorry I can’t help, debuging wodpress … I became allergic

    I really admire those who has the patience for it (I am TS dev)

    Thanks so much for your work

    [Sun Jan 22 19:53:19.605278 2023] [proxy_fcgi:error] [pid 28623:tid 140695142561536] [client 185.222.240.66:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Events::__construct() must be of the type int, string given, called in /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php on line 220 and defined in /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Events.php:22\nStack trace:\n#0 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php(220): Events->__construct()\n#1 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php(38): Fights->getEvent()\n#2 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fighters.php(207): Fights->__construct()\n#3 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fighters.php(61): Fighters->calculateNulls()\n#4 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/parts/post-single.php(921): Fighters->__construct()\n#5 /home/bmag/boxemag.com/www.prod/wp-includes/template.php(772): re…’, referer: https://boxemag.com/
    [Sun Jan 22 19:53:20.633753 2023] [proxy_fcgi:error] [pid 28545:tid 140695260059392] [client 66.249.64.190:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Events::__construct() must be of the type int, string given, called in /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php on line 220 and defined in /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Events.php:22\nStack trace:\n#0 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php(220): Events->__construct()\n#1 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fights.php(38): Fights->getEvent()\n#2 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fighters.php(207): Fights->__construct()\n#3 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/includes/Fighters.php(61): Fighters->calculateNulls()\n#4 /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/single-palmares.php(4): Fighters->__construct()\n#5 /home/bmag/boxemag.com/www.prod/wp-includes/template-loader.php(106):…’
    [Sun Jan 22 19:53:27.254245 2023] [proxy_fcgi:error] [pid 28622:tid 140695268452096] [client 2a01:e0a:2b1:d4c0:f943:1463:bcd0:26e2:0] AH01071: Got error ‘PHP message: PHP Warning: A non-numeric value encountered in /home/bmag/boxemag.com/www.prod/wp-content/themes/zox-news-child/parts/single-fighter/stats.php on line 42’, referer: https://www.google.com/

    • This reply was modified 1 year, 10 months ago by cantoute.
    Thread Starter cantoute

    (@cantoute)

    In my case, investigating this would imply to clone the site and dig in code made by some pigs.
    If it could give some clues, possible that some of the ACF fields are declared as numbers and contain text…
    Perhaps you want to wrap anything dealing with ACF in a try catch?

    public function varnish_flush_post( $post_id, $force = false ) {

    this seems to have done the trick for me too

    Thread Starter cantoute

    (@cantoute)

    I son’t see what allowing shortcode has to do with this.

    I think you just need to wp_strip_all_tags() on the values you set for og:title and twitter:title meta values. Perhaps something like $title = wp_strip_all_tags(get_the_title())

    As with your plugin we could disable it from adding those meta in header, this is how we fixed it.

    • This reply was modified 2 years, 2 months ago by cantoute.
    Thread Starter cantoute

    (@cantoute)

    Lucky… found a screenshot

    https://pasteboard.co/JJFBZehfpL01.png

    Thread Starter cantoute

    (@cantoute)

    I have no screen shots as fixed the issue by disabling social network meta.

    Example title of 2<sup>nd</sup>

    This is the ending result when usin wp-typography fir example

    Thread Starter cantoute

    (@cantoute)

    Hi,

    Thank you very much for this reply.
    Actually my client does have the payed version.

    I think it’s a good thing to have the choice to redirect 301 or 302.
    There are cases where 301 fits better, but I don’t think it’s what we want on landing url.

    Perhaps you want to have 3 options:
    – 301 every where
    – 302 every where
    – 302 on is_front_page() and 301 for the rest

    Just a thought.

    Have a nice day.

    • This reply was modified 2 years, 2 months ago by cantoute.
    Thread Starter cantoute

    (@cantoute)

    After deeper investigation, those filters did work, it was an other plugin that was adding the wrong lines in the head and overtaking yoast.

    Sorry for the noise.

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