关键词:
----- str_replace
<?php if(!empty($map)): ?><?php echo str_replace(array('[site-url]','[template-url]'),array(get_bloginfo('url'),get_bloginfo('template_url')), $map); ?><?php endif; ?>
----- WP QUERY $wp_query
$wp_query->found_posts
<?php echo get_post_type( $post ) ?>
----- апостроф кавычки дефис
' " -
----- base dir __FILE__ dirname
$baseDir = dirname(__FILE__);
$baseDir = realpath($baseDir);
---- redirect to current url
<?php
$redirecturl = '';
foreach($_GET as $i => $k)
if(!empty($i))
$redirecturl .= get_bloginfo('url').'/'.'?'.$i.'='.$k;
?>
----- human date time ago timestamp
<?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
----- спец символы декодирование слоган с тегами html convert html decode
html_entity_decode(get_bloginfo('description'))
----- регулярка с поиском градуса
<?php
$result = '';
preg_match("/(\d+\s\°\;)|(\d+\°\;)/", $item['summary'], $result);
if(!empty($result))
echo '<strong class="temp">'.current($result).'</div>';
?>
----- init over all
add_action('init', 'upload_files_process');
function upload_files_process()
----- check plugin is plugin active is active plugin
http://themergency.com/wordpress-tip-how-to-check-if-a-plugin-is-active/
----- upload file types
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() )
// add your extension to the array
$existing_mimes['deb'] = 'application/x-deb';
// add as many as you like
// removing existing file types
unset( $existing_mimes['exe'] );
// add as many as you like
// and return the new full result
return $existing_mimes;
----- current url with parameters текущий урл с параметрами
if ( ! function_exists( 'get_current_page_url' ) )
function get_current_page_url()
global $wp;
return add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) );
if ( ! function_exists( 'the_current_page_url' ) )
function the_current_page_url()
echo get_current_page_url();
----- php in js php in javascript
$marker_image_url = get_bloginfo('template_url').'/images/map-pin.png';
var image = <?php echo json_encode($marker_image_url); ?>;
------ insert in table
global $wpdb;
$table_name = $wpdb->prefix . 'test';
$wpdb->insert( $table_name, array( 'email' => $_REQUEST["subscribe_mailchimp"] ), array( '%s' ) );
----- get current url
global $wp;
echo home_url( $wp->request );
text有用(代码片段)
查看详情
text有用(代码片段)
查看详情
text有用(代码片段)
查看详情
text有用的东西(代码片段)
查看详情
text有用的书签。(代码片段)
查看详情
text有用的命令(代码片段)
查看详情
text有用的链接(代码片段)
查看详情
text有用的命令(代码片段)
查看详情
text有用的数学(代码片段)
查看详情
text有用的功能(代码片段)
查看详情
text我有用的别名(代码片段)
查看详情
text有用的码头图像(代码片段)
查看详情
text有用的快捷方式(代码片段)
查看详情
text一个有用的技巧(代码片段)
查看详情
text*shogun*-很有用(代码片段)
查看详情
text一些有用的扩展(代码片段)
查看详情
text有用的反应命令(代码片段)
查看详情
text[有用的库]一些有用的android库(代码片段)
查看详情