Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter wendallsan

    (@wendallsan)

    Figured it out . . . I was using a plugin called Custom Fields to add fields to my custom post type, which by default serializes everything, even fields that allow for only one value. You can’t use the meta_query with a serialized value, unless you search for the entire (unserialized) string. I fixed this by implementing the field in question manually in the custom post type rather than relying on the plugin for this field. Thanks very much for your input bcworkz!

    Thread Starter wendallsan

    (@wendallsan)

    bcworkz, you hit the head on the nail. thank you. Changing my print_r to var_dump indeed indicates that the meta data is stored as a string rather than an integer. However, changing my query’s value from an integer to a string still does not return any results. Here’s my modified code and output:

    $args = array( # GET ALL CHAPTERED_VIDEO POSTS WITH A META KEY OF 'SPEAKER'
        'posts_per_page' => -1,
        'post_type' => 'chaptered_video',
        'meta_query' => array(
            array(
                'key'=>'speaker'
            )
        )
    );
    
    $posts = get_posts($args); # GET THE POSTS
    
    foreach($posts as $post){ # LOOP THRU POSTS
        $meta = get_post_meta($post->ID, 'speaker', true); # GET THE POST'S 'SPEAKER' META
        echo "post '$post->post_name' speaker meta:<br/>"; # OUTPUT THE META
        var_dump($meta);
        echo "<br/><br/>";
    }
    
    $args = array( # GET ALL CHAPTERED_VIDEO POSTS WITH A META KEY OF 'SPEAKER' AND A META VALUE OF 145
        'posts_per_page' => -1,
        'post_type' => 'chaptered_video',
        'meta_query' => array(
            array(
                'key'=>'speaker',
                'value'=> "145" # THIS IS THE 1ST VALUE OUTPUT IN THE LOOP ABOVE
            )
        )
    );
    
    $posts = get_posts($args); # GET THE POSTS
    if (empty($posts)) echo "there are no posts<br/>"; # OUTPUT IF EMPTY
    else { # ELSE SHOW THE POSTS
        echo "posts: <br/>";
        var_dump($posts);
        echo "<br/><br/>";
        $posts_count = count($posts);
        echo "there are $post_count posts.<br/>";
    }

    This outputs:

    post 'who-do-you-say-that-i-am-session-1-expectation-of-a-messiah' speaker meta:
    array(1) { [0]=> string(3) "145" }
    
    post 'ancient-traditions-from-the-hebrew-scriptures-session-3' speaker meta:
    array(1) { [0]=> string(3) "151" }
    
    post 'ancient-traditions-from-the-hebrew-scriptures-session-2' speaker meta:
    array(1) { [0]=> string(3) "156" }
    
    post 'ancient-traditions-from-the-hebrew-scriptures-session-1' speaker meta:
    array(1) { [0]=> string(3) "158" }
    
    post 'ancient-traditions' speaker meta:
    array(1) { [0]=> string(3) "145" }
    
    there are no posts

    How can I get the posts? I figured that changing the value to the proper data type would work, but I’m still not getting any results back from my second get_posts() call.

    Thread Starter wendallsan

    (@wendallsan)

    I’ve got the conditionals bit figured out already, I just need to know enough about the profile page to remove the admin menus. I’ve already got into place in my theme the functionality to hide the top admin bar:

    $current_user = wp_get_current_user();
    if ( ($current_user instanceof WP_User) ){
    	$roles = $current_user->roles;  //$roles is an array ­
     	if($roles[0] == "subscriber") {
     		add_filter('show_admin_bar', '__return_false');
    	}
    }

    This works great, but the profile page doesn’t appear to be affected by anything I put into my theme folder. How can I get this functionality working on the profiles page?

    Hi Tim,

    I’m experiencing the same thing described by Jana on a site I’m working on, and can also confirm that Jana’s site is still experiencing the issue that she describes in her post. If you visit her site’s contact page with Chrome on Android, you can scroll indefinately to the left and down, way past the page content. I have the same issue on my site at:

    http://neighboragency.com/dev/connect/

    Placing the map on this page causes it to be scrollable infinitely to the left and downward. Removing the map from the page makes the problem go away. The plugin works fine in FF on the desktop, so maybe it’s an issue with mobile browsers, as she reports the issue on the iPad (but not iPhone?). Let me know if I can provide you with any further information about this issue, I’d like to help you (and her, and me) get this resolved.

    Thread Starter wendallsan

    (@wendallsan)

    closing post, thanks!

    Thread Starter wendallsan

    (@wendallsan)

    d’oh, you are correct– I’d done something wrong, have gone through the network setup instructions again, and am in business now. Thanks very much for your patience!

    Thread Starter wendallsan

    (@wendallsan)

    Hi and thanks very much for the response. I’ve deleted my physical ‘dev’ directory. I don’t see any changes to my WP site in that there is still no “My Sites” item on the WP toolbar and dev.mysite.com is now throwing a 500 internal server error, as the directory my ‘dev’ subdomain is pointing to no longer exists. Going to Tools > Create a Network shows the warning at the top of the page “Warning: An existing WordPress network was detected.” and all the .htaccess and wp-config.php stuff displayed on that page is in place. What would my next step be to troubleshoot this?

    WP is installed in the root of my server space so that WP’s index.php is at mysite.com/index.php. Thanks again for any input or help!

    Thread Starter wendallsan

    (@wendallsan)

    Thanks forl the response, after doing some reading, it looks like I need to use the subdomain approach rather than a subdir approach since this is an already-existing site. I’m going to try that route and will post a new topic when I (inevitably) have additional questions.

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