• Resolved samporras

    (@samporras)


    Hi.

    I’m new to WordPress development and am wondering if you’ve seen this before. I’ve installed your plugin and everything works great. I’ve even written some hooks on my pages to query custom posts and leverage GetPostQuery. This all works great on my local environment, but when attempting to move my code over to a hosting envioronment (multiple sites enabled), my code errors out when attempting to instantiate GetPostsQuery class. The plugin installed fine and I’ve created custom content. This is the only issue I’m seeing.

    Here is the code block where I’m seeing the error

    $Q = new GetPostsQuery();
    	$args = array();
    	$args['post_type'] = 'brands';
    	$args['productline'] = $products;
    
    	$results = $Q->get_posts($args);
    	$count = sizeof($results);

    Any help would be great!

    https://wordpress.org/plugins/custom-content-type-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    What errors are you getting?

    You may need to require the class:

    require_once CCTM_PATH.'/includes/GetPostsQuery.php';

    The CCTM manages its dependencies while in the manager, but if you’re trying to use a function/class in the front-end, it does not assume you need it, so it’s not loaded automatically.

    Thread Starter samporras

    (@samporras)

    thank you so much for the response! The include worked. The funny thing is that the code was running fine (without the include) on my local installation of wordpress, but seemed to break once I moved everything to the hosting environment. I ended up adding the include in functions.php of my theme. That seemed to work.

    Thanks!

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Glad that worked. Changing environments is a big change as far as code is considered. And WordPress is not really written to be ported between environments. Your local include path will vary between servers, so it’s not at all surprising if the code worked in one environment and failed in another.

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

The topic ‘issues accessing GetPostQuery on hosting environment’ is closed to new replies.