Forum Replies Created

Viewing 15 posts - 271 through 285 (of 330 total)
  • Author
    Posts
  • in reply to: Ordering above WordPress SEO #2077
    Jason
    Keymaster

    🙂

    in reply to: Ordering above WordPress SEO #2075
    Jason
    Keymaster

    This works:

    add_filter('wpseo_metabox_prio', 'move_yoast_metabox_to_bottom');
    function move_yoast_metabox_to_bottom() { return 'low'; }

    That’s a filter that was added by Yoast for exactly this purpose, so it’s safe to use.

    Enjoy! 🙂

    in reply to: Reordering the Piklist Add_More Array #2011
    Jason
    Keymaster

    Fixed a bug for the case of an empty image field and made a gist for this for easier revisions: https://gist.github.com/JasonTheAdams/d40351ecf5bca8a7e7f4#file-parse_piklist_array

    in reply to: Reordering the Piklist Add_More Array #2010
    Jason
    Keymaster

    I added support for the uploads field and nested groups. The resulting element will inherit the array of image ids if it’s an image, otherwise it will recursively work through the groups.

    function parse_piklist_array($array) {
      if ( empty($array) )
        return array();
    
      $keys = array_keys($array[0]);
      if ( empty($keys) )
        return array();
    
      $results = $values = array();
      $count = count($array[0][$keys[0]]);
      for ($index = 0; $index < $count; $index++) {
        foreach($keys as $key_index => $key) {
          $value = $array[0][$key][$index];
          if ( is_array($value) && !isset($value[0][0]) )
            $values[$key] = parse_piklist_array($value);
          else
            $values[$key] = $value;
        }
    
        $results[] = $values;
      }
    
      return $results;
    }
    
    in reply to: Conditional Metabox #1981
    Jason
    Keymaster

    Hmm.. apparently the $data parameter doesn’t hold unsupported comment data. Perhaps it’d be useful to to support a “custom” line, or else permit extra comment data.

    in reply to: Piklist in Pages #1979
    Jason
    Keymaster

    Amended the above code to avoid some php warnings:

    add_action('init', 'remove_unused_editors');
    function remove_unused_editors() {
      if ( !isset($_GET['post']) && !isset($_GET['post_ID']) )
        return;
    
      $post_id = ( isset($_GET['post']) ) ? $_GET['post'] : $_POST['post_ID'] ;
      $template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
    
      switch ($template_file) {
        case 'page-product-overview.php':
          remove_post_type_support('page', 'editor');
      }
    }
    in reply to: Groups in Settings #1920
    Jason
    Keymaster

    I tried using a radio instead.. no dice. But switching to a Select did the trick.

    in reply to: Groups in Settings #1919
    Jason
    Keymaster

    Another issue I’m having in the same group: After I add a second instance of the group and save the settings, the checkbox field no longer shows up once the page reloads. Only the checkbox field and only for the non-first fields.

    in reply to: Groups in Settings #1918
    Jason
    Keymaster

    Hi Steve!

    Good call on the first, and good to know for the second.

    I’m not sure if I should make a new thread for this, but it pertains to the context. I added another group field, slug, and gave it the field value “slug”. But, above the group is another field that has the same field value. I assumed that because the second slug was inside of a group it would recognize the difference. I believe it stores properly (that is it wouldn’t write to the same row), but apparently it doesn’t distinguish upon retrieval.

    Keep rockin, Piklist!

    in reply to: Dynamic Post Metabox #1904
    Jason
    Keymaster

    Hah! Sorry about that.. but thanks, Steve! 🙂

    in reply to: Bug? The editor field doesn't save the data in my CPT. #1707
    Jason
    Keymaster

    Maybe I’m wrong, but if the scope is post I believe the field has to be a column available to the wp_posts table (e.g. content, excerpt, etc.). Otherwise, if you omit the scope parameter (or use ‘post_meta’), it should save just fine to the wp_postmeta table.

    in reply to: Can't remove upload_media field items #1698
    Jason
    Keymaster

    Can you please paste the code you’re using to generate the field? I’ve found most bugs of this kind tend to come about from using unexpected field parameters.

    in reply to: Piklist in Pages #1684
    Jason
    Keymaster

    For those interested, I had a case where I wanted to hide the editor from only specific pages using a specific template. Here’s what I did:

    add_action('init', 'remove_unused_editors');
    
    function remove_unused_editors() {
    	$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
    	$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
    
    	switch ($template_file) {
    		case 'page-about.php':
    		case 'page-home.php':
    			remove_post_type_support('page', 'editor');
    	}
    }
    
    in reply to: Post-Relate question/bug #1682
    Jason
    Keymaster

    I’m trying to think through a context in which it would be advantageous to have a single post-relate field with multiple post types versus a field for each one. I mean, Piklist aside, you get one field per taxonomy.

    @puppet – Is there a reason to merge them instead of splitting them into multiple fields?

    in reply to: Text field in radio option #1681
    Jason
    Keymaster

    Perfect! Thanks!

Viewing 15 posts - 271 through 285 (of 330 total)