Forum Replies Created

Viewing 15 posts - 211 through 225 (of 330 total)
  • Author
    Posts
  • in reply to: Custom Post Type archives and posts giving a 404. Piklist bug? #2713
    Jason
    Keymaster

    If an issue like that happens and then goes away, it usually means you got bit by a cache imp. I’ve definitely had that happen, and it usually goes down like this:

    1. I break something.
    2. I view it in the browser and it (or the server) decide to cache at that moment
    3. I fix the issue.
    4. I look in the browser. Still looks broken.
    5. I stare, bewildered at my code as to how the same thing I’ve always done is now not working.
    6. I cry out to the heavens and curse out my profession, computer, etc..
    7. The cache decides to clear, everything works, and I’m deeply offended.

    🙂

    in reply to: Shortcode in Piklist #2621
    Jason
    Keymaster

    Why are you hooking the my_init_function to the init filter? I’d just cut the code out of the function and run it directly. The plugin file is running at its intended time, you don’t need to put all that in the init hook unless you’re doing something specific to that point. Chances are since you’re doing that the shortcode function isn’t running since you’re already in the init context when you go to add it.

    Hope this helps!

    ~Jason

    in reply to: How to call a Custom Post from "Single.php" #2619
    Jason
    Keymaster

    @ebarroso: It’s important to understand that the function I suggested shouldn’t be used inside something like single.php to get the posts you should be already getting. Doing this would be redundantly querying the posts again after WordPress has already done this for you. Follow what Steve put up concerning the template hierarchy.

    The get_posts function is useful in a context where the posts aren’t already queried. For example, if you want to grab the recent blog posts on the home page.

    in reply to: How to call a Custom Post from "Single.php" #2617
    Jason
    Keymaster

    You could also use the get_posts function, which would return you an array of WP_Post objects. You’d then loop through them with a foreach. This is my preferred method.

    $posts = get_posts(array(
      'post_type'  => 'qps',
      'numberposts'=> -1
    ));
    
    foreach($posts as $post) {
      $url = get_post_permalink($post->ID);
      echo "<p><a href='$url'>$post->post_title</a></p>";
      // etc..
    }

    Note, however, that if you use get_posts you handle the array of objects like you would any other time in PHP. You can no longer use the loop functions (e.g. the_title(), the_content(), etc.) as you’re not using the wp_query object and are therefore not inside “the loop”.

    Hope this helps!

    in reply to: Add a post image with piklist #2611
    Jason
    Keymaster

    I believe the file field stores it as a serialized single row. Try:
    $image_ids = get_post_meta($post_id, 'img_sec', true);

    Since you’re already using print_r, I suggest using that on $image_ids to help you know the structure of what you’re dealing with.

    Hope this helps! 🙂

    in reply to: Feature Request: Settings Button Parameter #2610
    Jason
    Keymaster

    Hi Steve,

    I was thinking as part of the Setting Page comment block. And the button I’m referring to is the submit button, which can be defined as part of the piklist_admin_pages array. So the following would be a tab with a submit button that says “Import”:

    /*
    Setttings: my-plugin-settings
    Tab: Import
    Submit Button: Import Now
    */

    And this would be a page with no submit button at all:

    /*
    Settings: my-plugin-settings
    Tab: Overview
    Submit Button: false
    */

    Does that make sense? 🙂

    in reply to: Reverse Display Order for Groups #2598
    Jason
    Keymaster

    Glad to help! If you have any issues feel free to add an Issue on github or make a pull request to add anything! I’m hoping folks will start adding to that more once they use Piklist regularly and have an idea of what would be useful. 🙂

    in reply to: Flexible content #2596
    Jason
    Keymaster

    Glad to help! Like I said, too much freedom to the user can be more encumbering than liberating. If I want them to have genuinely free control over a section, I’ll use the WYSIWYG.

    in reply to: Reverse Display Order for Groups #2595
    Jason
    Keymaster

    Hopefully Steve or someone who uses the Piklist template features will chime in, but I don’t personally use them.. the reason is the one that you’re experiencing now. I just want Piklist to store and retrieve the data for me, and I’ll determine how best to handle/manipulate it from there.

    If it’s a group, then I use my PiklistHelper::parse_array function to put it in an easier structure.

    I just use a foreach, parse through the content, and build the content. For example:

    $boxes = get_post_meta($post->ID, 'boxes_example', true);
    $boxes = array_reverse(PiklistHelper::parse_array($boxes));
    $list = '';
    foreach($boxes as $box)
      $list .= "<h2>{$box['caption']}</h2><p>{$box['content']}</p>";
    
    echo $list;

    Something like that, anyway. Now you can manipulate the array of data as you would any other array in php. No framework limitations. Hope this helps! 🙂

    in reply to: Flexible content #2592
    Jason
    Keymaster

    You could do something very similar to that using a group field with the add_more option turned on. From there, use a conditional for a select field (or something) to determine which fields to display.

    Without doing something very clever, it won’t work quite like what you’re seeing in the video in the link you’ve provided (columns, etc.). Honestly, though, I rarely offer that level of customization. I have complex fields, but it’s more to guide the user through an existing design. I use Piklist to provide the exact sorts of fields that will help the user customize within the design, but not break outside of it. That way, no matter what they do (within reason) the site will always look good. Mind you, if you’re designing open-ended themes, that can be tough.

    So, in short, you can do something very similar to that, but I’ve not personally had a need for that on the 5 themes I’ve developed with Piklist.

    Hope this helps! 🙂

    in reply to: Integrate PikList into Theme WITHOUT using the plugin. #2561
    Jason
    Keymaster

    Greetings!

    May I ask why you’re attempting to embed it within the theme versus using the plugin? What’s the merit?

    in reply to: Disable drag and drop reorder on add_more fields #2527
    Jason
    Keymaster

    Ok, I wondered if that’d do it. Try using the disable method then: http://api.jqueryui.com/sortable/#method-disable

    You may need to timeout for 100ms or so to make sure that you disable it after it’s already been enabled. Try first without a timeout, though.

    Please let us know if that does the trick!

    in reply to: Disable drag and drop reorder on add_more fields #2514
    Jason
    Keymaster

    Until it’s supported, you could use javascript to remove the ui-sortable class from the divs of interest. If, for example, your repeatable field has a name of “my-repeated-field”, then this should work:
    $('#_my-reapeated-field').find('.ui-sortable').removeClass('.ui-sortable');

    That’s untested, but something like that should work just fine. Notice the underscore (added by Piklist) to the front of the field name.

    Hope this helps! 🙂

    in reply to: Feature Request: Target default page template #2506
    Jason
    Keymaster

    @steve- Hmm.. well, I actually just added this to the Piklist core. I was more curious than anything. I’ll email this to you. You’re welcome to use it if you and Kevin feel that could be a reasonable part of the core. If you’d rather not use it, then I’ll just add this functionality to the PiklistHelper class.

    I was thinking about the ‘piklist_add_part’ hook, but it didn’t occur to me to do $data[‘role’] = ‘no-role’ as a way of tricking Piklist into not showing it. To be honest, that feels a bit clunky to me. Why not allow the user to return false and add an if ( false === $data ) return; after the apply_filters?

    Thanks!

    ~Jason

    in reply to: Can't remove file with the file field #2493
    Jason
    Keymaster

    Having the same issue in reverse, wherein if there’s an existing add-more group instance and the user goes to add a media file, it doesn’t take upon updating.

Viewing 15 posts - 211 through 225 (of 330 total)