Skip to content

Commit

Permalink
Ajusta nome do tema referente a pauta na listagem do plugin do DIVI no
Browse files Browse the repository at this point in the history
delibera
  • Loading branch information
samueldu committed May 25, 2016
1 parent 70c4833 commit edd07f4
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Thumbs.db
.project
.settings
.buildpath
.idea/*
*~
11 changes: 10 additions & 1 deletion delibera_topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,20 @@ function deliberaAddTerms($pauta_id, $args, $taxonomy = 'tema', $insert = true )
return $terms_ids;
}


/**
*
* @param WP_Post $post
* @param WP_REST_Request $request
*/
function deliberaApiCreate($post, $request)
{
$args = $_POST;
$args['post_id'] = $post->ID;
if(empty($post->post_name))
{
$post->post_name = sanitize_title($post->post_title);
wp_update_post($post);
}
deliberaCreateTopic($args);
}
add_action('rest_insert_pauta', 'deliberaApiCreate', 10, 2);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions includes/wp-divi/ET_Builder_Module_Delibera_Member/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

254 changes: 254 additions & 0 deletions includes/wp-divi/ET_Builder_Module_Delibera_Member/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,21 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
'post_status' => 'publish',
'posts_per_page' => 1,
);
if(is_array($include_categories))

if($include_categories)
{
$args['tax_query'] = array(
array(
'taxonomy' => 'tema',
'field' => 'tag_id',
'field' => 'tag_ID',
'terms' => $include_categories,
'include_children' => false
)
);
}

$wp_posts = array();

if($orderby == 'pauta' && $pauta_id != false && $pauta_id > 0)
{
$post = get_post($pauta_id);
Expand All @@ -337,19 +339,21 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
$wp_posts = get_posts($args);
}

$image_code = '';
$image_code = '';
$pauta_url = "";
$titulo = "";
$tema = false;
$tema = '';
$temaLink = "";
$autor = "";
$tags = "";
$avatar = "";
$except = "";

foreach($wp_posts as $key=>$value)
{

$term_list = wp_get_post_terms($wp_posts[$key]->ID, 'tema', array("fields" => "all"));
print_r($term_list);
if(is_array($term_list) && count($term_list) > 0)
{
$tema = $term_list[0]->name;
Expand Down
Loading

0 comments on commit edd07f4

Please sign in to comment.