Skip Navigation

[Resolved] displaying child posts with parent

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 18 replies, has 2 voices.

Last updated by davidm-13 4 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1805075

I previously had a this thread:
https://toolset.com/forums/topic/create-page-with-parent-post-details-followed-by-table-of-all-child-post-details/
where Jamal suggested the problem was with the hosting company. I've moved the site to new hosting and url.
Now florapal.org but I'm experiencing the same problem. Please could you check to see what the problem is.
Thanks

#1805581

Hi,
The problem seems to be between localhost and a hosting server. I've hosted this site on 2 different servers, the site has the same problem on both servers - child posts do not appear with the parent post.
When I set up the same site on localhost (I suspect that you tested it on your localhost) everything works as it should - parent and child posts appear on the same page.
Does this give an indication of where the problem may be?
Thanks

#1806089

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for getting in touch.

Would you mind allowing me to have access to the site as well as the page where you are testing this out.

Also would it be ok to disable your plugins and switch the theme as a part of the debugging process?

Please let me know as i've enabled the private fields for your next response.

Thanks,
Shane

#1806387

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Something is causing views to only display posts from the default Post type from wordpress.

Do you have access to your website's server logs ?

If so can you send them to me so that I can have a look to see if I can find anything there?

Thanks,
Shane

#1806397

I have this file: accesslog_florapalaestina-ethnobotany.org_10_9_2020.gz
which I've downloaded.
If this is what you want to see how/where do I send it

#1806407

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

This seems like the access logs, what I need are the server's php error logs.

If you're not sure how to get this then you can contact your host and ask them to provide you with these logs.

To send me the logs you can upload them to Dropbox or Google drive and share the file with me.

Thanks,
Shane

#1806421
error-log.JPG

I've requested the error logs from my hosting, but in the meantime I found this - attached.

#1806487

Hi Shane,
I've put error.log and debug.log on Google drive in toolset folder - link is hidden link

The hosting support says error.log is the log I want, it was in public_html folder where the website is.
Let me know if you need something else or want access to cpanel
Thanks

#1806773

Hi Shane,
I'm unable to activate Toolset Views plugin!

#1807479

Hi Shane, know this is not connected, but maybe you can give me an example of including PHP code in a View - I see it's suggested to wrap PHP code in shortcode, but can't find any examples of how to.
If I wanted to include

<?php
  echo "Hello World!";
?>

In a View (or Content Template) how would I do this?
Thanks

#1808889

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I'm still having a look at the issue but its definitely related to your server.

Unfortunately we can't o much when it comes to server issues. As you say this exact same site works on your localhost so something related to the server is preventing our views plugin from querying the correct post type.

For your query about the shortcode you can use this tool below to auto generate your shortcode information.
hidden link

Please let me know if it helps.
Thanks,
Shane

#1808979

Hi Shane, Thanks for checking this.

I've copied the website to a new a new server - Award Space (as suggested by Jamal in my previous thread), you can check this link:

hidden link (login details are the same )

Exactly the same problem so it's not an issue related to just the one server.

Also I'm unable to activate the Toolset Views plugin for florapalaestina-ethnobotany.org, which is deactivated since you started checking, please can you activate this plugin.

Thanks

#1809079

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

HI David,

Thanks would you mind if I installed the duplicator plugin to grab a copy of the site to test here locally

Please let me know.

Thanks,
Shane

#1809107

Please do - all I want is to get this working.
Please also activate the Toolset Views plugin - I've tried but it remains deactivated
Thanks

#1810415

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

The issue is being caused by this code here.

<?php
/**
 * Search complaints for any or all complaint-use, system, herbal actions selected
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

add_filter( 'wpv_filter_query', 'prefix_show_only_current_author', 99,3);
  
function prefix_show_only_current_author( $query_args,$view_setting,$view_id ) {
if($view_id == 19221){
  if(isset($_POST['submit'])) {
      $relation = 'OR';
      $radioVal = $_POST["all-any"];
      if($radioVal == 'All') {
          $relation = 'AND';
      }
	$count = 0;
  	$taxquery = array( 'relation' =>  $relation);
    //  $taxquery = array();
    if( isset($_POST['wpv-complaint']) and ($_POST['wpv-complaint'] != '') ) {
       $count++;
        array_push($taxquery,array(
                'taxonomy' => 'complaint-use',
                'field' => 'term_id',
                'terms' => $_POST['wpv-complaint'],
            ));
    }
    if( isset($_POST['wpv-system-state']) and ($_POST['wpv-system-state'] != '') ) {
       $count++;
        array_push($taxquery,array(
                'taxonomy' => 'system',
                'field' => 'slug',
                'terms' => $_POST['wpv-system-state'],
            ));
    } 
      if( isset($_POST['wpv-actions']) and ($_POST['wpv-actions'] != '') ) {
       $count++;
        array_push($taxquery,array(
                'taxonomy' => 'action-medicinal',
                'field' => 'slug',
                'terms' => $_POST['wpv-actions'],
            ));
    }
// echo '<pre>'; print_r($taxquery); echo '</pre>';
  // if $taxquery has array;
if($count > 0){
    $query_args['tax_query'] = $taxquery;
    return $query_args;
    } else {
      die("No search items selected");      
    }
  }
}
}

I suggest going through the code line by line to debug it. I suspect the issue is with the scoping of the view ID.

What I would do is to remove all the other if statements and check to see if the correct view is being targetted with the ID that has been specified.

Please let me know if this helps.
Thanks,
Shane