Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23965

    Is there a way to show Related Entries of portfolio entries when you have the portfolio set to the AJAX presentation (where they pop up on the same page)? I like the way the Related Entries display at the bottom of the page, but it looks like they are only viewable when you set the portfolio entries to open on a single page and not on the AJAX option.

    #121815

    Hi,

    Open functions-eunoia.php then find this code

    //check if the portfolio item was requested by an ajax call and returns that
    if(!function_exists('avia_check_ajax_request')){

    add_action('wp_ajax_avia_check_portfolio', 'avia_check_ajax_request');
    add_action('wp_ajax_nopriv_avia_check_portfolio', 'avia_check_ajax_request');

    function avia_check_ajax_request()
    {
    if(!isset($_POST['avia_ajax_request'])) return false;

    global $avia_config, $more;
    $avia_config['avia_is_overview'] = false;
    $avia_config['is_ajax_request'] = true;

    $id = $_POST['avia_ajax_request'];

    global $post;
    $post = get_post( $id );
    setup_postdata($post);

    $more = 0;
    $slider = new avia_slideshow($id);
    $slider -> setImageSize('fullsize');
    $sliderHTML = $slider->display();
    $post_class = avia_post_meta('portfolio-layout');

    echo "<div class='ajax_slide ajax_slide_".$id." ".$post_class."' data-slide-id='".$id."' >";

    echo "<div class='inner_slide'>";

    echo "<div class='flex_column two_third first portfolio_container_image'>";
    echo $sliderHTML;
    echo "</div>";

    echo "<div class='portfolio-entry one_third portfolio_container_content'>";

    echo "<div class='portfolio_title_meta'>";
    echo avia_title(array('class'=>'portfolio-title', 'html' => "<div class='{class} title_container'><h1 class='main-title'>{title}</h1></div>"), $id);

    $meta = avia_portfolio_meta($id);
    if($meta)
    {

    echo $meta;
    echo avia_advanced_hr(false, 'hr_dotted ');
    }
    echo "</div>";

    echo "<div class='entry-content'>";

    the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> &rarr;</span>');
    echo "</div>";

    echo "</div>";

    echo "</div>";

    echo "</div>";

    die();
    }
    }

    Replace it with this code

    //check if the portfolio item was requested by an ajax call and returns that
    if(!function_exists('avia_check_ajax_request')){

    add_action('wp_ajax_avia_check_portfolio', 'avia_check_ajax_request');
    add_action('wp_ajax_nopriv_avia_check_portfolio', 'avia_check_ajax_request');

    function avia_check_ajax_request()
    {
    if(!isset($_POST['avia_ajax_request'])) return false;

    global $avia_config, $more;
    $avia_config['avia_is_overview'] = false;
    $avia_config['is_ajax_request'] = true;

    $id = $_POST['avia_ajax_request'];

    global $post;
    $post = get_post( $id );
    setup_postdata($post);

    $more = 0;
    $slider = new avia_slideshow($id);
    $slider -> setImageSize('fullsize');
    $sliderHTML = $slider->display();
    $post_class = avia_post_meta('portfolio-layout');

    echo "<div class='ajax_slide ajax_slide_".$id." ".$post_class."' data-slide-id='".$id."' >";

    echo "<div class='inner_slide'>";

    echo "<div class='flex_column two_third first portfolio_container_image'>";
    echo $sliderHTML;
    echo "</div>";

    echo "<div class='portfolio-entry one_third portfolio_container_content'>";

    echo "<div class='portfolio_title_meta'>";
    echo avia_title(array('class'=>'portfolio-title', 'html' => "<div class='{class} title_container'><h1 class='main-title'>{title}</h1></div>"), $id);

    $meta = avia_portfolio_meta($id);
    if($meta)
    {

    echo $meta;
    echo avia_advanced_hr(false, 'hr_dotted ');
    }
    echo "</div>";

    echo "<div class='entry-content'>";

    the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> &rarr;</span>');
    echo "</div>";

    echo "</div>";

    echo "</div>";

    echo "</div>";

    //show related posts based on categories if there are any
    get_template_part( 'includes/related-posts' );

    die();
    }
    }

    Regards,

    Ismael

    #121816

    Many thanks! The Related Entries show up on the AJAX presentation now.

    #121817

    Hey,

    Glad it worked.

    Cheers,

    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Related Entries at bottom of AJAX portfolio entries’ is closed to new replies.