Forum Replies Created

Viewing 15 posts - 1,801 through 1,815 (of 2,964 total)
  • Author
    Posts
  • in reply to: [Feature Request] Add Class attribute for metabox #3658
    Steve
    Keymaster

    @Marc– Welcome to the Piklist community!

    We had a long list of items to add to the comment block, including class, but we decided to go in another direction since the list was growing every week.

    In the next version of Piklist you will be able to add your own custom parameters to the comment block. So class or marcs class or anything else you want can be added.

    in reply to: Select box for custom post type #3657
    Steve
    Keymaster

    @ehime– Welcome to the Piklist community!

    Your code is very close. The last array is telling Piklist what to save and what to display. You are saving the ID and displaying the title. These parameters should relate directly with your WP database table. You can see the schema here.

    There is no field title in the wp_posts table, the actual field is post_title.

    Change the last part of your code to this and it should work:

         ,array(
           'ID'
           ,'post_title'
         )
    in reply to: [Request] Limit to single file #3653
    Steve
    Keymaster

    @jcrist– On our list of todos. We wanted to first get the server-side validation solid because it’s more secure.

    in reply to: PikList_Meta::get_metadata() Slowing down site #3652
    Steve
    Keymaster

    @spitfire– The idea behind these enhanced meta queries was to speed up your site and allow Piklist to do some amazing things in the future. I just emailed you the latest version of our beta which fixes the issues with the queries and provides a checkbox for you to opt in.

    Also, just to be clear, if you opt in you will see additional queries… but your site should also see a performance improvement. Though there will be more queries they are better optimized then the default WordPress meta queries. $more_queries !== $slower_site.

    in reply to: Issues Registering Private Taxonomies #3650
    Steve
    Keymaster

    @ianmuscat– I suggest you get it working properly with the standard WordPress function. Then you can port it over to us the Piklist filter if you like.

    in reply to: Error in Documentation #3646
    Steve
    Keymaster

    Both fixed. Thanks!

    Steve
    Keymaster

    @liquidws– Sorry for the delayed response.

    IMPORTANT: Piklist does everything the WordPress way. You don’t have to rely on Piklist documentation to display post meta. Any WordPress tutorial on post meta would help you.

    1) You’re using get_posts to retrieve your post data which is fine, except this function does not retrieve post_meta, which you need. So $post->slide1_title does not exist.

    2) You can easily see what is being returned by a function by using the standard PHP function print_r, or the Piklist function piklist::pre(). The Piklist function is just a prettier version of print_r.
    Either one of these would show you what get_posts was returning:

    $posts = get_posts(array(
      'post_type' => 'page',
      'page_id' => 2
    ));
    
    print_r($posts);
    piklist::pre($posts);

    3) To retrieve post_meta, just use the standard WordPress function get_post_meta.

    4) When using the Piklist file field, the data that is saved is the Attachment ID, which WordPress automatically creates. Then you need to use this ID to retrieve the data you need. Since you can upload multiple files, Piklist saves all the IDs, and you need to loop through them to get the information you want. This tutorial explains it.

    Here is your new code based on what I wrote above. Please let me know if something does not make sense.

    foreach($posts as $post) {
    
      $url = get_post_permalink($post->ID); ?>
    
      <h2><?php the_title(); ?></h2>
      <img class="img-responsive" src="http://placehold.it/1280x250/16a085/ffffff&text=Page"/>
      <h3 style="color:#fff"><?php echo get_post_meta($post->ID, 'slide1_title', true); ?></h3>
    
        <?php // Get all the slide1_image IDs and then loop through them
        $slide1_image_ids = get_post_meta($post->ID, 'slide1_image', true); ?>
    
          <?php foreach ($slide1_image_ids as $image_id) : ?>
    
            <img class="img-responsive" src="<?php echo wp_get_attachment_url($image_id); ?>"/>
    
          <?php endforeach; ?>
    
          <?php echo get_post_meta( $post->ID, 'slide1_description', true ); ?>
    
          <?php // Get all the slide1_select_page_links IDs and then loop through them
          $slide1_select_page_links = get_post_meta($post->ID, 'slide1_select_page_link', false); ?>
    
          <?php foreach ($slide1_select_page_links as $page_link) : ?>
    
            <a href="<?php echo get_permalink($page_link); ?>" target="_blank">website</a>
    
          <?php endforeach;
    }
    in reply to: Editor Field not saving data #3644
    Steve
    Keymaster

    @liquidws– In most cases the “scope” of the field is the database table you are saving it to. You are setting the scope to “post”, which is the WordPress posts table… wp_posts. Which is fine, if you use any of the fields WordPress allows. Which in your case would probably be post_content or post_excerpt. But you are saving it to a custom field, careers_description, which is not allowed in wp_posts… but is allowed in wp_postmeta.

    Just remove the scope parameter and Piklist will figure it out and save it properly.

    You can see the full WordPress database schema here >

    in reply to: Is there a hook After post_meta is saved? #3639
    Steve
    Keymaster

    Great. Closing ticket.

    in reply to: Taxonomy Hierarchy Issue #3636
    Steve
    Keymaster

    @ravinder123– Welcome to the Piklist community!

    This is actually quite difficult to achieve. We’re adding this to our list of todos, but for now we recommend you doing it with the standard WordPress code. Sorry we couldn’t be more helpful on this one.

    in reply to: Calculation in Add-more fields #3634
    Steve
    Keymaster

    Great. Closing ticket.

    in reply to: Settings – How to Generate Dynamic CSS #3630
    Steve
    Keymaster

    @Gregg– Glad it works for you. Closing ticket.

    in reply to: Is there a hook After post_meta is saved? #3628
    Steve
    Keymaster

    @hirschbrat– Try these two hooks and see if they work for you:

    WordPress: updated_{$meta_type}_meta
    Piklist: piklist_save_field in class-piklist-form.php

    in reply to: Calculation in Add-more fields #3627
    Steve
    Keymaster

    @hirschbrat– It’s not as fancy as you think. We just pulled in the fields, added them up, and displayed the sum.

    in reply to: Settings – How to Generate Dynamic CSS #3626
    Steve
    Keymaster

    @Gregg– You can use inline CSS in your theme’s . Try something like this in your theme’s functions.php file:

    add_action('wp_head', 'my_custom_css');
    function my_custom_css()
    {
      $options = get_option('YOUR-OPTION-NAME');
    ?>
    
     <style type="text/css">
        html {
          background-color: <?php echo $options['background-color']; ?>;
        }
      </style>
    <?php
    }

Viewing 15 posts - 1,801 through 1,815 (of 2,964 total)