Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • in reply to: last update 0.10 or 0.11 conditions don't work #8949
    ralmestro
    Member
    in reply to: last update 0.10 or 0.11 conditions don't work #8946
    ralmestro
    Member

    code posted

    in reply to: last update 0.10 or 0.11 conditions don't work #8943
    ralmestro
    Member

    Thanks a lot Steve, after update conditions are working, but I found another bug, the editor field never get visible in conditions when use ‘scope’ => ‘post’.

    in reply to: Tabs aren't working and demos won't disable #6866
    ralmestro
    Member

    Thanks, for the info @cyclissmo.

    Using this info I find the solution to solve this problem https://piklist.com/support/topic/repeated-tabs-in-workflow-settings-v0-9-9-8/#post-6643 (I reported a few weeks ago), to solve the problem the menu_slug value can’t be the same as setting value (in settings page parameters).

    Thanks

    in reply to: repeated tabs in workflow settings v0.9.9.8 #6621
    ralmestro
    Member

    @steve- the code is for use in a theme, it’s a simple code and can be used it in any theme.

    in reply to: Switching framework #4307
    ralmestro
    Member

    Hi, @zoker – For radio button list I didn’t test the images example but must be work, but I create two example, instead images I have used font icons. Check the attachment image.

    Radio Fields

    piklist('field', array(
    	'type' => 'radio'
    	,'scope' => 'post_meta'
    	,'field' => 'gender'
    	,'value' => 'female'
    	,'label' => 'Gender'
    	,'list' => false
    	,'attributes' => array(
    		'class' => 'text radio_icon_fa'
    		)
    	,'choices' => array(
    		'female' => '<i class="fa fa-female fa-5x"></i>'
    		,'male' => '<i class="fa fa-male fa-5x"></i>'
    		)
    	));
    piklist('field', array(
    	'type' => 'radio'
    	,'scope' => 'post_meta'
    	,'field' => 'image_align'
    	,'value' => 'aleft'
    	,'label' => 'Align Image:'
    	,'list' => false
    	,'attributes' => array(
    		'class' => 'text icon_radio'
    		)
    	,'choices' => array(
    		'aleft' => '<i class="dashicons dashicons-align-left"></i>'
    		,'acenter' => '<i class="dashicons dashicons-align-center"></i>'
    		,'aright' => '<i class="dashicons dashicons-align-right"></i>'
    		,'anone' => '<i class="dashicons dashicons-align-none"></i>'
    		)
    	));

    CSS

    
    .piklist-field .piklist-field-list-item {
    	width: auto;
    	height: 100%;
    	position: relative;
    }
    .piklist-field .piklist-field-list-item span i.dashicons {
    	font-size: 40px;
    	width: 40px;
    	height: 40px;
    	overflow: visible;
    }
    .piklist-field .piklist-field-list-item input[type=radio]{
    	display: none;
    }
    .piklist-field .piklist-field-list-item span i {
    	color: rgba(0,0,0,0.15);
    }
    .piklist-field .piklist-field-list-item input[type=radio]:checked + span i {
    	color: #00a0d2;
    }
    

    Hope this be helpful

    Attachments:
    You must be logged in to view attached files.
    in reply to: Piklist and CPU use #2555
    ralmestro
    Member

    Thanks for the response…Yeah the result is pretty shocking haha, I have another question: I’m using W3 Total Cache and when active the “Object Cache” the plugin stop saving.

    in reply to: Metabox for pages except for a custom page template? #2305
    ralmestro
    Member

    @steve – I know about the updates, sorry but I not explained myself well, should have specified the solution as a suggestions.

    Thanks for the tutorial, is a simple and well explained solution.

    in reply to: Metabox for pages except for a custom page template? #2298
    ralmestro
    Member

    reading the forum I find the solution added by jmcphail in Suggestion: Be able to add metaboxes field to a specific page to add the metabox to specific page template before was implemented by default on piklist, the I make a variation to implemente the possibility to exclude the metabox for a list of pages templates

    Only need to overwrite the function register_meta_boxes_callback on class-piklist-cpt.php

    public static function register_meta_boxes_callback($arguments)
      {
        global $post, $pagenow;
    
        extract($arguments);
    
        $current_user = wp_get_current_user();
    
        $data = get_file_data($path . '/parts/' . $folder . '/' . $part, apply_filters('piklist_get_file_data', array(
                  'name' => 'Title'
                  ,'context' => 'Context'
                  ,'description' => 'Description'
                  ,'capability' => 'Capability'
                  ,'role' => 'Role'
                  ,'priority' => 'Priority'
                  ,'order' => 'Order'
                  ,'type' => 'Post Type'
                  ,'lock' => 'Lock'
                  ,'collapse' => 'Collapse'
                  ,'status' => 'Status'
                  ,'new' => 'New'
                  ,'id' => 'ID'
                  ,'div' => 'DIV'
                  ,'template' => 'Template'
                  ,'nointemplate' => 'No Template' // ADDED - get the list of templates where not be included
                  ,'box' => 'Meta Box'
                ), 'meta-boxes'));
    
        $data = apply_filters('piklist_add_part', $data, 'meta-boxes');
    
        $types = empty($data['type']) ? get_post_types() : explode(',', $data['type']);
        
        foreach ($types as $type)
        {
          $type = trim($type);
    
          $statuses = !empty($data['status']) ? explode(',', $data['status']) : false;
          $ids = !empty($data['id']) ? explode(',', $data['id']) : false;
          $name = !empty($data['name']) ? $data['name'] : 'piklist_meta_' . piklist::slug($part);
          $notemplates = !empty($data['nointemplate']) ? explode(', ', $data['nointemplate']) : false; // ADDED - Convert to Array
          
          if (post_type_exists($type)
            && (!$data['capability'] || ($data['capability'] && current_user_can(strtolower($data['capability']))))
            && (!$data['role'] || ($data['role'] && piklist_user::current_user_role($data['role'])))
            && (!$data['status'] || ($data['status'] && in_array($post->post_status, $statuses)))
            && (!$data['new'] || ($data['new'] && $pagenow != 'post-new.php'))
            && (!$data['id'] || ($data['id'] && in_array($post->ID, $ids)))
            && (!$data['template'] || ($data['template'] && $data['template'] == pathinfo(get_page_template_slug($post->ID), PATHINFO_FILENAME)))
            && (!$data['nointemplate'] || ($data['nointemplate'] && !in_array(pathinfo(get_page_template_slug($post->ID), PATHINFO_FILENAME), $notemplates))) // ADDED - compare to exclude id the templates are in the array
          )
          {
            $id = !empty($data['div']) ? $data['div'] : 'piklist_meta_' . piklist::slug($part);
            $textdomain = isset(piklist_add_on::$available_add_ons[$add_on]) && isset(piklist_add_on::$available_add_ons[$add_on]['TextDomain']) ? piklist_add_on::$available_add_ons[$add_on]['TextDomain'] : null;
             
            add_meta_box(
              $id
              ,!empty($textdomain) ? __($name, $textdomain) : $name
              ,array('piklist_cpt', 'meta_box')
              ,$type
              ,!empty($data['context']) ? $data['context'] : 'normal'
              ,!empty($data['priority']) ? $data['priority'] : 'low'
              ,array(
                'part' => $part
                ,'add_on' => $add_on
                ,'order' => $data['order'] ? $data['order'] : null
                ,'config' => $data
              )
            );
    
            if (isset($data['box']) && strtolower($data['box']) == 'false')
            {
              add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'lock_meta_boxes'));
              add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'no_meta_boxes'));
    
              if ($name == 'piklist_meta_' . piklist::slug($part))
              {
                add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'no_title_meta_boxes'));
              }
            }
            else
            {
              if (isset($data['lock']) && strtolower($data['lock']) == 'true')
              {
                add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'lock_meta_boxes'));
              }
              if (isset($data['collapse']) && strtolower($data['collapse']) == 'true')
              {
                add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'collapse_meta_boxes'));
              }
            }
            add_filter("postbox_classes_{$type}_{$id}", array('piklist_cpt', 'default_classes'));
          }
        }
      }
    

    How to Use

    Build your piklist meta-boxes field file with the following example header declaration:

    /*
    Title: Normal Page Metabox
    Post Type: page
    No Template: template-slug-1, template-slug-2
    */

    In your theme only need to create your templates where not need the use the metabox and add the slug name without the .php, as you see can add more than one template page using ‘, ‘ between them.

    In the code I commented the lines added, Hope this solution can help!

    in reply to: meta_box on pages not saving #2069
    ralmestro
    Member

    Thanks a lot, the new update fix the problem.
    Have a nice weekend.

    in reply to: meta_box on pages not saving #2066
    ralmestro
    Member

    Thanks!

    in reply to: meta_box on pages not saving #2059
    ralmestro
    Member

    Thanks for the reply so fast, yes the code work ok, but the problem is when you create more than one page, try to create more than two pages, and even try to update the page saved.
    Thanks for the compliment, but credit is only by the piklist’s team, with the last updates I want to improve the example including the fields validations and the fields sanitization

    in reply to: Two Bugs on upload files #1506
    ralmestro
    Member

    @Steve thanks for your response, about the the second bug, as I comment before I use the demo in the plugin, then the code is there, let me explain:

    -Go to add a new piklist demos
    -Go to the Basic Tab
    -Add File on that tab
    -Go to the Featured Image(s)
    -Add a file there

    Now you’ll see the image added in the “feature image(s)” field will be appear in the first “add file” field used, the same happen if you invert the order.

Viewing 13 posts - 1 through 13 (of 13 total)