Forum Replies Created

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • in reply to: Error in Documentation #3641
    ianmuscat
    Member

    Also, there is another error on – https://piklist.com/user-guide/docs/taxonomies/

    In the code block, hide_meta_box should be inside the configuration array.

    in reply to: Piklist and CPU use #2569
    ianmuscat
    Member

    Hi Steve,

    Thank you for your reply. Usually, Piklist’s performance is not an issue for me – I’ve used it in the past and I never needed to tweak anything. However, I am working on a large, high-traffic site at the moment and as soon as we went live with a version of the site that made use of Piklist, the CPU usage shot up because of all the queries being made to the DB and the site even went offline for a few minutes because MySQL crashed.

    After some digging around, we commented out the mentioned lines and the site stabilized and the number of queries on each page decreased dramatically.

    If you need additional information, I’d be able to provide this via e-mail, just let me know where to reach you guys 🙂

    Once again, thank you for all your help regarding the matter.

    Regards,
    Ian

    in reply to: Piklist and CPU use #2558
    ianmuscat
    Member

    HI,

    I actually came here to post about the exact same issue I am facing. However, I’ve narrowed the issue down to several queries that Piklist seems to be making (I’m not 100% sure what these queries are for).

    I’ve been using Query Monitor (https://wordpress.org/plugins/query-monitor/) and it seems that the site I’m testing is generating ~134 Queries just for the home page. I’ve done some digging and it seems these queries are originating from …Piklist/includes/class-piklist-meta.php. As soon as I comment out the following lines (again, I’m not 100% sure what there use is), the query count drops to ~23 queries – quite a stark difference!

       add_filter('get_post_metadata', array('piklist_meta', 'get_post_meta'), 100, 4);
        add_filter('get_user_metadata', array('piklist_meta', 'get_user_meta'), 100, 4);
        add_filter('get_term_metadata', array('piklist_meta', 'get_term_meta'), 100, 4);

    It seems that what I’m using from Piklist (mainly metaboxes) still seem to work ok, so I’m not particularly sure what effect the mentioned lines have, however the load on MySQL, and therefore the load on the CPU is drastically reduced – I’m not sure if this is related to some sort of bug, but for higher-traffic sites, this is quite a performance hit.

    Regards,
    Ian

    in reply to: Piklist Update Breaks 'Editor' Field in Add More #2288
    ianmuscat
    Member

    It did not occur to me initially, however, it seems like another plugin is causing this issue – I’ll need to look into what’s causing this.

    Thanks for your help.

    Regards,
    Ian

    in reply to: Piklist Update Breaks 'Editor' Field in Add More #2281
    ianmuscat
    Member

    Hmmm.. It seems like I am not being allowed to upload the file (I tried both .php and .txt). Here is the code I’m using…

    <?php
    /*
    Title: Tests
    Description: Add or remove tests
    Post Type: test
    Order: 1
    Lock: true
    Collapse: true
    */
    
    /* 
     * Get Test Settings
     */
    $test_options = get_option('setting_test');
    
    /* 
     * Get Default Test Settings
     */
    $test_default_test_content = $test_options['default_test_item_content'];
    
    /*
     * Test Item
     */
    piklist('field', array(
       'type' => 'group'
      ,'field' => 'test_item'
      ,'add_more' => true
      ,'fields' => array(
    
    /*
     * test Name
     */
    array(
       'type' => 'text'
      ,'field' => 'test_name'
      ,'label' => __('Test Title','piklist')
      ,'description' => __('Enter a title for this test.','piklist')
      ,'help' => __('Enter a title for this test.','piklist')
      ,'attributes' => array(
        'class' => 'large-text'
        ,'placeholder' => __('Enter title here','piklist')
      )
      ,'on_post_status' => array(
        'value' => 'lock'
      )
      ,'sanitize' => array(
      array(
        'type' => 'title'
        ,'context' => 'save'
      )
    )
    )
    
    /*
     * Test Content
     */
    ,array(
      'type' => 'editor'
      ,'field' => 'test_content'
      ,'label' => __('Test Content','piklist')
      ,'description' => __('Enter content for this test.','piklist')
      ,'help' => __('Enter content for this test','piklist')
      ,'value' => $test_default_test_content
      ,'options' => array (
        'wpautop' => false
        ,'media_buttons' => true
        ,'tinymce' => true
        ,'quicktags' => true
      )
    )
    
    /*
     * Test Background Color
     */
    ,array(
    'type' => 'colorpicker'
    ,'field' => 'test_background_color'
    ,'label' => __('Test Background Color','piklist')
    ,'description' => __('Select a background color for this test','piklist')
    ,'help' => __('Select a background color for this test','piklist')
    ,'attributes' => array(
      'class' => 'text'
    )
    )
    
    )
    ));
    in reply to: Piklist Update Breaks 'Editor' Field in Add More #2280
    ianmuscat
    Member

    @steve – Apologies for the late reply. Here is the code I’m using for my Metabox.

    Regards,
    Ian

    in reply to: Piklist Update Breaks 'Editor' Field in Add More #2264
    ianmuscat
    Member

    UPDATE – I noticed that saving the post will cause the field to appear after the post has been saved.

    I am trying this in a metabox of a custom post type.

    Regards,
    Ian

    in reply to: Piklist Update Breaks 'Editor' Field in Add More #2263
    ianmuscat
    Member

    UPDATE – I noticed that saving the post will cause the field to appear after the post has been saved.

    I am trying this in a metabox of a custom post type.

    Regards,
    Ian

    in reply to: Listing CPT posts in a metabox using Piklist #2231
    ianmuscat
    Member

    Awesome. I’ll take a closer look at the demos.

    Just out of curiosity, could you provide a scenario for using post-to-post relationships? – I’m not 100% sure I understood their purpose. Would this be similar to having two tables in a DB rated to one another?

    I did manage to get most of @jason ‘s code working for my requirements, but I am curious if I could use relate two posts and create select field as opposed to a checkbox section.

    Once again, thanks so much for your help!

    Regards,
    Ian

    in reply to: Listing CPT posts in a metabox using Piklist #2228
    ianmuscat
    Member

    Hi Steve,

    This works like a charm. I was over complicating my solution. I can’t thank you enough!

    You may mark this as resolved.

    Ian

    in reply to: Getting index of Add More items while in the loop #2174
    ianmuscat
    Member

    Hi,


    @jason
    – Thank you so much for your help – I ended up using your solution to work around this.

    Many thanks,
    Ian

    in reply to: Getting index of Add More items while in the loop #2171
    ianmuscat
    Member

    Hi Jason,

    Thank you so much for your input! I will try this out first thing tomorrow and let you know if I managed to get this to work.

    Thanks once again for your help.

    Regards,
    Ian

    in reply to: Getting index of Add More items while in the loop #2169
    ianmuscat
    Member

    Hi Jason,

    Apologies for the late reply – I tried out your updated code and it works like a charm – this will be useful for counting the total number of ‘add-more’ items easily.

    However, I am still stuck with regards to knowing which item I am on inside of the Piklist loop. Once again, the idea is to be able to determine what index a particular ‘add-more’ item has so I can print it inside the add-more template which is getting repeated via the Piklist loop.

    Regards,
    Ian

    in reply to: Getting index of Add More items while in the loop #2161
    ianmuscat
    Member

    Hi Steve,

    Thank you so much – I’ll be awaiting your suggestion.

    Ian

    in reply to: Getting index of Add More items while in the loop #2147
    ianmuscat
    Member

    Hi,

    I do apologize for several posts, however, I’m facing some challenges and I can’t seem to figure it out myself. I re-read my post and perhaps I might have not been as clear as to what I wish to achieve. My custom post type is outputting a series of add-more items, each one is being looped using the Piklist loop in a template file. So, far that works fine. However, I need to be able to also print out (in the template) what add-more item this is on.

    So, if I have the following array being outputted

    Array
    (
        [piklist_test_title] => Array
            (
                [0] => Test
                [1] => Test 2
            )
    
        [slide_content] => Array
            (
                [0] => <p>some text.</p>
                [1] => <p>some text.</p>
            )
    
        [piklist_test_content] => Array
            (
                [0] => Array
                    (
                        [0] => 1687
                    )
    
                [1] => Array
                    (
                        [0] => 
                    )
    
            )
    
        [piklist_test_color] => Array
            (
                [0] => #6b6b6b
                [1] => 
            )
    
        [piklist_test_option] => Array
            (
                [0] => Array
                    (
                        [0] => option-1
                    )
    
                [1] => Array
                    (
                        [0] => option-1
                    )
    
            )
    
    )

    I would need to be able to echo ‘#1’ if the array is at position [0] in the add-more template (the template that is being looped). An idea I had was to possibly use the following from @jasonhttps://gist.github.com/JasonTheAdams/d40351ecf5bca8a7e7f4#file-parse_piklist_array

    However, I haven’t been able to get that working properly either.

    Any input would be greatly appreciated, thanks in advance. Please let me know if any further information is required.

    Regards,
    Ian

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