Viewing 8 reply threads
  • Author
    Posts
    • #9083
      courtens
      Participant

      I would like to keep the code as lean as possible. (I am afraid of Piklist overhead.)

      Is this also how Piklist uses the Double Underscore?

      Thanks for the support!

    • #9084
      Steve
      Keymaster

      @courtens– Welcome to the Piklist community!

      The double underscore allows strings to be translated into other languages. So, yes.

    • #9085
      courtens
      Participant

      Hi Steve. Thank you so much for all the awesome support. As you may have noticed — through my recent activity on different fronts — I am working on figuring out how to best structure my blog data for a multi language, multi domain blog-add-on to an existing asp website. So far so good, I got my posts lining up: FilmFix Blog. I also got now my Piklist “check box” working.

      <?php
      /*
      Title: Blog/Post Type
      Post Type: blog
      Order: 0
      */
      
       piklist('field', array(
          'type' => 'group'
          ,'field' => 'blog_list'
          ,'label' => __('', 'blog')
          ,'list' => false
          ,'fields' => array(
            array(
              'type' => 'select'
              ,'field' => 'select_com'
              ,'value' => 'com'
              ,'choices' => array(
      			'com' => __('com', 'blog')
      			,'ch' => __('ch', 'blog')
      			,'net' => __('net', 'blog')
              )
              ,'columns' => 3
            )
            ,array(
              'type' => 'select'
              ,'field' => 'select_ser'
              ,'value' => '8mm'
              ,'choices' => array(
      			'8' => __('8mm', 'blog')
      			,'16' => __('16mm', 'blog')
      			,'slide' => __('slide', 'blog')
      			,'tape' => __('tape', 'blog')
      			,'dvd' => __('dvd', 'blog')
      			,'other' => __('other', 'blog')
              )
              ,'columns' => 4
            )
            ,array(
              'type' => 'select'
              ,'field' => 'select_l'
              ,'value' => 'e'
              ,'choices' => array(
                'e' => 'English'
                ,'g' => 'German'
                ,'f' => 'French'
              )
              ,'columns' => 3
            )
          )
        ));

      Note: I did not remove Double Underscores “__” in the code.

      I am generating the api data with WordPress, using a defined post type in CPT UI. I was using Custom Fields to generate WordPress taxonomies for the different posts, but decided to switch to Piklist taxonomies instead. How can I get the Piklist taxonomies into the api data? (Before the switch I could see the taxonomy data. Now it is missing…)

      I noticed, it looks like the taxonomies are not making it to the wp_term_taxonomy table, but somehow are getting stored somewhere else!?! However, I do see piklist_demo_type data in the table, so somehow I need to figure out how to add new taxonomies to my defined post type.

      For later: how can I add taxonomy filters to my defined post type list?

      Do you suggest I keep each post as it’s own individual post (a new one for each language, to keep pretty permalinks and other WordPress functionalities in place – … and for speed,) and later find a way to cross-link them in the back-end UI? This would be best, I suppose, to link posts and languages linked.

    • #9086
      Steve
      Keymaster

      I’m not 100% clear on your question. Piklist taxonomies are essentially WordPress taxonomies with extra options.

      If data is not making it the terms table, make sure your code is in the /terms folder.

    • #9087
      courtens
      Participant

      Somehow I just can’t get control over setting taxonomies to my defined “blog” plug-in (custom post type.)

      This doc page helps, but I am missing how-to steps for these lines:

      Create a function with your Taxonomy parameters. (example is missing)
      Hook it to the piklist_taxonomies filter. (example is missing)

      This is what I have for my plug-in blog.php file:

      <?php
      /*
      Plugin Name: Blogs
      Text Domain: blogs
      Description: Used to control Taxonomies for Blogs.
      Text Domain: blogs
      Domain Path: /blogs
      */  
         
      add_filter('piklist_taxonomies', 'blog_taxonomies');
      	function blog_taxonomies($taxonomies)
      	{
      		$taxonomies[] = array(
      			'object_type' => 'ff_language'
      			,'name' => 'ff_language'
      			,'configuration' => array(
      				'hierarchical' => true
      				,'labels' => piklist('taxonomy_labels', 'Language Selected')
      				,'show_ui' => true
      				,'query_var' => true
      				,'rewrite' => array(
      					'slug' => 'blog-type'
      				)
      				,'show_admin_column' => true
      				,'list_table_filter' => true
      			)
      		);
      
      		return $taxonomies;
      	} 

      and here is my /meta-box somefile.php file:

      <?php
      /*
      Title: Blog/Post Type
      Post Type: blog
      Order: 0
      */
      
       piklist('field', array(
          'type' => 'group'
          ,'field' => 'gr'
          ,'list' => false
          ,'fields' => array(	
            array(
              'type' => 'select'
      		,'scope' => 'taxonomy'
              ,'field' => 'ff_language'
              ,'choices' => piklist(
      			  get_terms('ff_language', array(
      				'hide_empty' => false
      			  ))
      			  ,array(
      				'term_id'
      				,'name'
      			  )
      			)
              ,'columns' => 4
            ), 
            array(
              'type' => 'select'
      		,'scope' => 'taxonomy'
              ,'field' => 'ff_nav'
              ,'value' => 'other'
              ,'choices' => array(
      			'8' => '8mm'
      			,'16' => '16mm'
      			,'slides' => 'slide'
              )
              ,'columns' => 4
            )
            ,array(
              'type' => 'select'
      		,'scope' => 'taxonomy'
              ,'field' => 'ff_domain'
              ,'value' => 'any'
              ,'choices' => array(
      			'any' => 'any'
      			,'com' => 'only .com'
      			,'ch' => 'only .ch'
              )
              ,'columns' => 4
            )
        ));

      at this point only the first select “pretends” to be linked to a taxonomy; however, making changes to the select is not sticking if clicking on “Save Draft” or “Publish.”

    • #9088
      courtens
      Participant

      I just got it working…

      	piklist('field', array(
      		'type' => 'select'
      		,'scope' => 'taxonomy'
      		,'field' => 'ff_language'
      		,'choices' => array(
      			'' => 'Choose Term'
      		)
      		+ piklist(get_terms(array(
      			'taxonomy' => 'ff_language'
      			,'hide_empty' => false
      			))
      			,array(
      				'term_id'
      				,'name'
      			)
      		)
      		,'columns' => 3
      	));

      Thank you for all the support!

    • #9089
      courtens
      Participant
      This reply has been marked as private.
    • #9097
      Steve
      Keymaster
      This reply has been marked as private.
    • #9098
      Steve
      Keymaster

      Great! I’m going to close this ticket.

Viewing 8 reply threads
  • The topic ‘Double Underscore "__" in Piklist’ is closed to new replies.