Wordpress
Adding posts
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_posts_field_id',
'mode' => 'posts',
'title' => 'My Wordpress posts',
'options' => array(
'post_type' => array('post', 'my_cpt_1', 'my_cpt_2'),
'numberposts' => 10,
),
'multiple' => true, //Optional: to "false" by default
),
);
Adding menus
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_menus_field_id',
'mode' => 'menus',
'title' => 'My Wordpress menus',
'multiple' => true, //Optional: to "false" by default
),
);
Adding pages
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_pages_field_id',
'mode' => 'pages',
'title' => 'My Wordpress pages',
'multiple' => true, //Optional: to "false" by default
),
);
Adding post types
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_posttypes_field_id',
'mode' => 'posttypes',
'title' => 'My Wordpress post types',
'multiple' => true, //Optional: to "false" by default
),
);
Adding tags
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_tags_field_id',
'mode' => 'tags',
'title' => 'My Wordpress tags',
'multiple' => true, //Optional: to "false" by default
),
);
Adding taxonomies
<?php
$tea_content = array(
array(
'type' => 'wordpress',
'id' => 'my_taxonomies_field_id',
'mode' => 'taxonomies',
'title' => 'My Wordpress taxonomies',
'multiple' => true, //Optional: to "false" by default
'options' => array( //Default value is 'category'
'term' => 'category',
),
),
);
Retrieve data
Using the _get_option('my_tags_field_id')
method, you'll get (with a json_encode()
display):
"25"
["24", "25", "26", "27"]
Updated less than a minute ago