HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/linde/wp-content/themes/linde/single.php
<?php
/**
 * The Template for displaying all single posts
 *
 * Methods for TimberHelper can be found in the /lib sub-directory
 *
 * @package  WordPress
 * @subpackage  Timber
 * @since    Timber 0.1
 */

    $context     = Timber::context();


    $timber_post     = Timber::get_post();
    $context['post'] = $timber_post;
    $context['articles_page_link'] = get_field('articles_page', 'options');
    $current_post_id = $timber_post->ID;

    $args_base = [
        'post_type'      => 'post',
        'post_status'    => 'publish',
        'orderby'        => ['date' => 'DESC'], // Ensure sorting by date
        'meta_query'     => [
            'relation' => 'OR', // Allow either condition
            [ // don't include posts set to be visible only on the lva platform
                'key'     => 'post_visibility',
                'value'   => 'lva-platform', 
                'compare' => '!=',
            ],
            [
                'key'     => 'post_visibility',
                'compare' => 'NOT EXISTS', // Include posts without this field
            ]
        ],
        'posts_per_page' => 1,
        'fields'         => 'ids', // Only get post IDs
    ];

    $prev_args = array_merge($args_base, [

        'date_query' => [
            ['before' => get_the_date('Y-m-d H:i:s', $current_post_id),
             'inclusive' => false,
            ]
        ]
    ]);


    $previous_post = get_posts($prev_args);
    if (!empty($previous_post)) {
        $context['previous_post'] = Timber::get_post($previous_post[0]);
    }


    $next_args = array_merge($args_base, [
        'orderby' => ['date' => 'ASC'],
        
        'date_query' => [
            [
                'inclusive' => false,
                'after' => get_the_date('Y-m-d H:i:s', $current_post_id)]
        ]
    ]);

    $next_post = get_posts($next_args);
    if (!empty($next_post)) {
        $context['next_post'] = Timber::get_post($next_post[0]);
    }



    Timber::render( array('single.twig' ), $context );