Last active
January 31, 2019 01:05
-
-
Save gugaalves/15d946a92b2b98197a8b9646b0ce1ccc to your computer and use it in GitHub Desktop.
Revisions
-
Guga Alves revised this gist
Jan 30, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ // Add Shortcode function button_category($post_id) { $category = get_the_category( $post_id ); $return = '<a href="'. esc_url( get_category_link( $category[0]->term_id ) ) .'">Ver ' . $category[0]->cat_name . '</a>'; -
Guga Alves created this gist
Jan 30, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // Add Shortcode function button_category($post_id) { $getpost = get_posts( array('number' => 1, 'offset' => 1) ); $category = get_the_category( $post_id ); $return = '<a href="'. esc_url( get_category_link( $category[0]->term_id ) ) .'">Ver ' . $category[0]->cat_name . '</a>'; return $return; } add_shortcode( 'button-category', 'button_category' );