⌘T | go to file |
⌘⌃P | go to project |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
⌃ ` | python console |
⌘⇧N | new window (useful for new project) |
This file contains 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 characters
/** | |
* set the limit number of posts in archive page | |
* @return none | |
*/ | |
function limit_posts_per_archive_page() { | |
if ( is_date() ) | |
$limit = 10; | |
elseif ( is_search() ) | |
$limit = 10; | |
else |
This file contains 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 characters
/** | |
* ADD HELLOPEOPLE POST TYPE | |
*/ | |
add_action( 'init', 'create_post_type' ); | |
function create_post_type() { | |
register_post_type('celebrities', array( 'label' => 'Celebrities','description' => 'Display images in three columns','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => true,'rewrite' => array('slug' => ''),'query_var' => true,'has_archive' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('celebrities',),'labels' => array ( | |
'name' => 'Celebrities', | |
'singular_name' => 'celebrity', | |
'menu_name' => 'Celebrities', |
This file contains 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 characters
/** | |
* GET TIME SINCE PUBLISHED | |
*/ | |
function get_time_since_posted() { | |
$time_since_posted = human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' 전에'; | |
return $time_since_posted; |
This file contains 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 characters
add_filter('manage_posts_columns', 'posts_columns_id', 5); | |
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2); | |
add_filter('manage_pages_columns', 'posts_columns_id', 5); | |
add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2); | |
function posts_columns_id($defaults){ | |
$defaults['wps_post_id'] = __('ID'); | |
return $defaults; | |
} | |
function posts_custom_id_columns($column_name, $id){ | |
if($column_name === 'wps_post_id'){ |
This file contains 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 characters
mb_strrchr($string, 'CHAR') |
This file contains 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 characters
$string = mb_substr($string,0,-1); |
This file contains 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 characters
#box { | |
position: relative; | |
border: 1px solid #E0E0E0; | |
} | |
#box:before, #box:after { | |
display: block; | |
content: ""; | |
clear: both; | |
} |
This file contains 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 characters
//FUNCTION FILE | |
function get_category_tags($args) { | |
global $wpdb; | |
$tags = $wpdb->get_results | |
(" | |
SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, null as tag_link | |
FROM | |
wp_posts as p1 | |
LEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID | |
LEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id |
This file contains 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 characters
query_posts('category_name=category-slug'); | |
if (have_posts()) : | |
while (have_posts()) : the_post(); | |
$posttags = get_the_tags(); | |
if ($posttags) { | |
foreach($posttags as $tag) { | |
$all_tags_arr[] = $tag->name; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique | |
} |
NewerOlder