Forum Replies Created

Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • in reply to: forms tutorial? #8744
    Anthony
    Member

    +1

    in reply to: Custom Post Type Relationships #8736
    Anthony
    Member

    I am a little confused here. Referring to the Piklist Documentation it has me setting up a post relate in this fashion:

    
    /**
     * Title: Chapters
     * Post Type: book
     * Context: normal
     * Priority: high
     */
    
    piklist('field', array(
      'type' => 'select'
      ,'title' => 'Chapters'
      ,'choices' => piklist(get_posts(array(
        'numberposts' => -1
        ,'post_type' => 'chapters'
      )), array('ID', 'post_title'))
      ,'relate' => array( 'scope' => 'post' )
      ,'attributes' => array( 'class' => 'multiple' )
    ));
    

    First it wasn’t saving the value till I added this little tidbit that wasn’t in the docs:

    
    ,'field' => '_' . piklist::$prefix . 'relate_post'
    

    When I ran this query as presented in the docs:

    
    $chapters = get_posts(array(
      'post_type' => 'chapter'
      ,'numberposts' => -1
      ,'suppress_filters' => false
      ,'relate_query' => array(
        array(
          'id' => $book_id
          ,'relate' => 'belongs'
        )
      )
    ));
    

    I noticed that running piklist::pre($chapters) yielded all of the chapter post types. Again I had to revert to your code above:

    
    // Displaying your related posts is as simple as using WP_Query with one extra parameter, post_belongs
      $related = get_posts(array(
        'post_type' => 'post'
        ,'posts_per_page' => -1
        ,'post_belongs' => $post->ID
        ,'post_status' => 'publish'
        ,'suppress_filters' => false
      ));
    

    I got it working which is great but was just curious as to why there is a disparity between the docs and what I find in these forums. Just want to assure I am not losing my mind here. Thank you for your continued support and for producing such a powerful plugin. I use this plugin EVERYWHERE.

    in reply to: Retrieving Data from a Group #8693
    Anthony
    Member

    That helped. There’s a stray : in your answer after ('my_theme_settings')

    Once I figured that out I could see the array. Pardon my ignorance (cause I have plenty of it) but can you provide me a link to a case where I was processing this array. I am used to the post object array but don’t have a foothold on getting this with a custom array such as this. I know … I am freakin’ newbie. Anything helps. Thanks for the help so far.

    in reply to: Retrieving Data from a Group #8689
    Anthony
    Member

    I did something similar but using field groups inside my settings page such as:

      piklist('field', array(
        'type' => 'group'
        ,'columns' => 4
        ,'field' => 'social_identities'
        ,'label' => __('Connected Accounts', 'piklist-demo')
        ,'list' => false
        ,'description' => __('Please include your account or usernames for any social identity or platform you utilize.', 'piklist-demo')
        ,'fields' => array( 
    
    array(
      'type' => 'text'
      ,'field' => 'setting_facebook_user_id'
       ,'columns' => 6
     ,'label' => 'Facebook® User ID'
     // ,'description' => 'Field Description'
     // ,'help' => 'This is help text.'
     // ,'value' => 'Default text'
      ,'attributes' => array(
      'class' => 'text'
      )
     ) 
     
     
    , array(
      'type' => 'text'
      ,'field' => 'setting_facebook_id'
       ,'columns' => 6
     ,'label' => 'Facebook® ID'
     // ,'description' => 'Field Description'
     // ,'help' => 'This is help text.'
     // ,'value' => 'Default text'
      ,'attributes' => array(
      'class' => 'text'
      )
     )
    	    
    

    However when I tried to retrieve it using it on the frontend such as:

    
    <?php 
    		
    	$theme_options = get_option('my_theme_settings');
    
      $text_field = $theme_options['setting_facebook_user_id'];
    
      echo $text_field ;
    		
    	?>
    

    It doesn’t retrieve the a value. This is not an exact example of what I am trying to do which is to get images from a field group.

    
      piklist('field', array(
        'type' => 'group'
        ,'field' => 'sitewide_defaults'
        ,'label' => __('Home Page Banner', 'piklist-demo')
        ,'list' => false
        ,'description' => __('Select the images you want appearing on your frontpage banner. Please use images that are at least 1600 x 700', 'piklist-demo')
        ,'fields' => array( 
    	    
    
    array(
        'type' => 'file'
        ,'field' => 'homepage_banner_images'
         ,'columns' => 6
        ,'label' => __('Select Primary Images', 'piklist-demo')
         ,'description' => __('Try to limit your images to 4 to assure prompt page loads. More images will slow down homepage load which is bad for SEO', 'piklist-demo')
        ,'options' => array(
          'modal_title' => __('Add File(s)', 'piklist-demo')
          ,'button' => __('Add', 'piklist-demo')
        )
      )
    
    

    I don’t know how to retrieve its values. I don’t see examples where field groups are used in the settings page. I use it to keep track of a variety of different site wide settings. I hope this is possible.

    in reply to: Conditional if post_belongs = false #7558
    Anthony
    Member

    It got me onto a better solution.

    Just trying to use the pre_get_posts within the functions.php so that the single custom post type ‘sponsor’ grabs the ‘posts’ that are attributed to that ‘sponsor.’

    
    function be_event_query( $query ) {
    	
    	if ( $query->is_main_query() && !$query->is_feed() && !is_admin() && is_singular('sponsor') ) {
    
    	$query->set('post_type',array('sponsor'));		
    
    	// I am trying to add the post_belong or the post_has here!!	
    
    		$query->set( 'meta_query', $meta_query );
    	} elseif ( $query->is_main_query() && !$query->is_feed() && !is_admin() ) {
    		
    		$meta_query = array(
    			array(
    				'key' => 'post_clearance',
    				'value' => 'true',
    				'compare' => 'IN'
    			)
    		);
    
    	
    	}
    
    }
    add_action( 'pre_get_posts', 'be_event_query' );
    
    in reply to: Custom Post Type question #5582
    Anthony
    Member

    I was able to temporarily fix it by adding this just prior to the if (have_posts)

    query_posts(array('post_type' => array('sponsor')));

    Not sure this is ideal but it can do for right now. The issue is ultimately that though its set have_archive it doesn’t have anything in the $post object by default. Not sure why …

    in reply to: Custom Post Type question #5581
    Anthony
    Member

    I tested the slug and changed the name. I updated the permalink to a new slug of the_sponsor and it was able to load an single post but not the archive still. 🙁

    in reply to: Custom Post Type question #5578
    Anthony
    Member

    Same issues and I tried everything you stated in REPLY #1260

    I setup my CPT using:

    add_filter('piklist_post_types', 'sponsor_post_type');
     function sponsor_post_type($post_types)
     {
      $post_types['sponsor'] = array(
        'labels' => piklist('post_type_labels', 'Sponsor')
        ,'title' => __('Enter Sponsor Name')
        ,'public' => true
        ,'has_archive' => true
        ,'rewrite' => array(
          'slug' => 'sponsor'
        )
    	    ,'supports' => array(
    	      'author'
    	      ,'revisions'
    	      ,'title'
    	      ,'editor'
    	      ,'excerpt'
    	      ,'thumbnail'
    	      
    	    )
        ,'hide_meta_box' => array(
          'revisions'
          ,'comments'
          ,'commentstatus'
        )
      );
    return $post_types;
    }

    I have saved and re-saved the permalink setup for it to rewrite its .htaccess rules but I am still loading the index.php file with a “nothing found.” message.

    Plugins have all been disabled *save for Piklist. Thanks again in advance for the help!

    in reply to: media uploads not working #5550
    Anthony
    Member

    I think I found the problem. Out of desperation I read thru the server logs and found that mySQL was failing to update tables. Decided to run Onyx on mac. Cleared caches, ran disk permissions and restarted MAMP. Voila! Everything works again. This work is nerve racking! Sorry for the false alarm. However, if I find the issue returning, I might chime in on other relevant discoveries. :: face in palm ::

    in reply to: media uploads not working #5548
    Anthony
    Member

    Alright I am able to work around this issue a bit by enabling custom fields in the view panel. There you can see that both the post_header_banner & post_title_banner have custom fields there and blank. If I delete them and then, upload the media to their respective fields. It works. Is this something that can get repaired fairly quickly? Or is there a more elegant workaround, beta release of Piklist, or update to the meta-box file that can sort this?

    in reply to: Metabox Locations Not Locking #5547
    Anthony
    Member

    the beta was better. In addition, used Global Meta Box plugin to keep things consistent throughout. Worked like a charm.

    in reply to: Retrieving related posts #5534
    Anthony
    Member

    @Jason: I will have to test again, it didn’t work for me. Do you have a quick snippet to build off from? Perhaps link to another thread where this has been demonstrated?

    in reply to: Retrieving related posts #5529
    Anthony
    Member

    I ask cause I wanted to paginate the results.

    in reply to: Retrieving related posts #5527
    Anthony
    Member

    Is it possible to use the new WP Query to achieve the same as the get_posts() function? Like:

     $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
      $query_args = array(
        'post_type' => 'post',
        'paged' => $paged,
        'post_has' => $post->ID,
        'suppress_filters' => false     
      );
      // create a new instance of WP_Query
      $the_query = new WP_Query( $query_args );
    
    if ( $the_query->have_posts() ) :
    while ( $the_query->have_posts() ) : $the_query->the_post();
    

    Would prefer to use this kind of loop instead of a for_each

    in reply to: Simple Checkbox (True or Value) #5256
    Anthony
    Member

    Verified.

Viewing 15 posts - 1 through 15 (of 30 total)