Forum Replies Created

Viewing 15 posts - 226 through 240 (of 330 total)
  • Author
    Posts
  • in reply to: Inline fields #2467
    Jason
    Keymaster

    Oh, hahah! I automatically set the columns according to the width I’d use for first/last names inside of a group. Full width tends to look like too much for fields that merit a short answer.

    But, yes, we can definitely agree that 5 + 5 = 10. Let it be so. 🙂

    in reply to: Inline fields #2455
    Jason
    Keymaster

    Greetings!

    Try this:

    piklist('field', array(
      'type'    => 'group',
      'field'   => 'name',
      'label'   => 'Name',
      'fields'  => array(
        array(
          'type'    => 'text',
          'field'   => 'first',
          'label'   => 'First',
          'columns' => 5
        ),
        array(
          'type'    => 'text',
          'field'   => 'last',
          'label'   => 'Last',
          'columns' => 5
        )
      )
    ));

    You’ll notice that each field in the group has a “columns” value. This is on a grid of 12. So if you have two fields whose columns sum are >= 12, they’ll appear on the same row.

    Hope this helps! 🙂

    in reply to: Custom Post Type Structure #2452
    Jason
    Keymaster

    Hi baar,

    To modify your custom post type permastructure take a look at this old tutorial for a start: http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2

    The WordPress functions of interest are add_rewrite_tag, add_permastruct, and add_rewrite_rule.

    Hope this helps! 🙂

    in reply to: Woocommerce #2445
    Jason
    Keymaster

    Hi Marcus!

    WooCommerce works from a template system. Within the plugin there are templates in the templates/ directory. Simply copy the contents to your theme as /theme-name/woocommerce/. From that point on, it will retrieve your templates rather than what’s in the plugin.

    From there, add the extra settings as you would any other menu and meta-boxes as you would any other post type. You then go through the somewhat tedious process of modifying the templates to reflect what you want. While doing this, just use the get_post_meta and get_option functions to retrieve the meta as you would any other time.

    As a side note, the WooCommerce product has a “custom fields” meta-box, but it’s very simple. It’s not a bad idea to remove this via remove_meta_box and adding your own (better) meta-boxes. There’s nothing fancy to this meta-box, as it simply stores the key as-is in the database (no wc_ prefix or anything).

    Hope this helps!

    in reply to: Woocommerce #2443
    Jason
    Keymaster

    You sure can! I’ve done it a couple times now. You can also add additional settings pages if you’d like. 🙂

    in reply to: Kevin, Steve, how much damage am I doing? :-) #2423
    Jason
    Keymaster

    You know, I’ve used Sublime Text 3 a number of times now, and I really like it. I just wish it had better vim support (the modes and such). There’s a plugin that tries valiantly (https://github.com/guillermooo/Vintageous), but isn’t quite there yet.

    Especially when it comes to quickly splitting the window into multiple files and navigating buffers, I just find it slow. For all it’s super cool tricks, I find vim can do almost all of it faster (just not as cool looking).

    Currently I use gvim on Ubuntu 14.04. It works well. 🙂

    in reply to: Kevin, Steve, how much damage am I doing? :-) #2420
    Jason
    Keymaster

    Wow.. well done. That kind of tedium makes my brain demand an automated form. If you use vim, I probably would’ve at least made a macro for the task. Hopefully you did something like that.

    But! It’s done now! 🙂

    in reply to: HTML Docs need some fixin #2419
    Jason
    Keymaster

    Cool! My only concern would be that it’s not actually storing the html field in the settings, right?

    in reply to: Returning false to piklist_pre_update_option #2417
    Jason
    Keymaster

    Yeah.. that’s what I’m trying to figure. It’s certainly and advanced case. I’d be happy to move along for now and see if it becomes a show-stopper in any form down the road. In fact, as I’m thinking about it, I bet I could just use the validation framework. Furthermore.. I’m not really even sure how achievable it is, as the pre_update_option hook assumes you’re already in the process, and I’m not sure it can be stopped.

    Let’s call this an edge-case for now and move along happily. 🙂

    in reply to: Intermittent Values Displaying #2413
    Jason
    Keymaster

    I believe so. I haven’t seen this in a while, and I’m using 0.9.5d.

    in reply to: HTML Docs need some fixin #2412
    Jason
    Keymaster

    Hmm.. I wonder if this is broken in 0.9.5d, then.

    piklist('field', array(
      'type'    => 'html',
      'label'   => 'Field 1',
      'value'   => '<p>Field 1</p>',
    ));
    
    piklist('field', array(
      'type'    => 'html',
      'label'   => 'Field 2',
      'value'   => '<p>Field 2</p>',
    ));

    in reply to: Returning false to piklist_pre_update_option #2409
    Jason
    Keymaster

    I’m honestly not sure. I know you’re using theh pre_update_option wp hook, and I took a look at that code. It looks like returning false would simply store a false value in WP. So perhaps this would be a feature Piklist would have to work in itself. But in that case, I’m honestly not sure if that’s something that should be added.

    I guess what I’m thinking of is something like validation. If a validation fails, it doesn’t save the data, but instead presents the admin notice. For most instances that’s enough, but sometimes pre_update_option must be used to further crunch the data in order to determine it’s validation. It’d be nifty, at that point, to be able to stop the update process and present an admin notice.

    But perhaps this is a bit too much? Currently I add a $settings[‘error’] and check for that the next time the page loads, presenting the admin notice if it exists and clearing it. So it’s certainly doable, it just doesn’t stop the other settings from being updated.

    Thoughts?

    in reply to: Some goodies for Piklist #2403
    Jason
    Keymaster

    I did it! Piklist Helper has been moved from the gist to Github. So if you have any problems/questions using it, add an issue. If you have a sweet idea or validation you commonly use, do a pull-request! I also touched up the README as to explain how to use it and what it’s all about.

    Check it out: https://github.com/JasonTheAdams/PiklistHelper

    in reply to: Datepicker Validation #2402
    Jason
    Keymaster

    Hi afspnational,

    Couple of things:

    First, you can’t put the callback function in the same file as the Piklist fields. Honestly, I’m not sure why this is, but I know it to be true. If you move the “piklist_validation_rules” hook and function to your functions.php (or something like it), then that much will work.

    Second, the way validations work is that if the callback returns a string it means that the validation failed and it displays the string you provide (which you’re doing). But, if the validation is to pass, the callback must return true.

    Other than that, it looks pretty good! Hope this helps! 🙂

    P.S. You’re more than welcome to leave a comment on the PiklistHelper gist for help. This sort of validation would make a perfect addition to the list of validations. Perhaps the best thing would be to move it to a Github repository so I can include a README for instructions..

    in reply to: Determining the settings tab #2396
    Jason
    Keymaster

    Nice! I ended up using an isset on the $new parameter to check if a specific field exists on the page, and return $settings if not, but that’s great to know!

    Thanks Marcus!

Viewing 15 posts - 226 through 240 (of 330 total)