example usage: examples.php
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 characters
<?php | |
$beforeTime = microtime(true); | |
function helloWorld() { | |
// Do stuff | |
} | |
$afterTime = microtime(true); | |
echo "Loading helloWorld: ".($afterTime - $beforeTime) . '<br />'; |
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 characters
<?php | |
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; | |
$parents = get_post_ancestors( $post_id ); | |
$id = ($parents) ? $parents[count($parents)-1]: $post_id; | |
$parent = get_page( $id ); | |
if ( get_id_by_page_name('states') == $parent->ID ) { | |
// do stuff | |
} | |
?> |
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 characters
<?php | |
/** | |
* Get a Page's ID by post_name (slug) | |
*/ | |
function get_id_by_page_name($post_name) { | |
global $wpdb; | |
$post_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$post_name."'"); | |
if ( ( $post_name_id !== NULL ) || ( $post_name_id !== '0' ) ) { | |
return $post_name_id; | |
} |
To shut off all comments/trackbacks/pingbacks in the WordPress Admin, the steps for cleanup are:
- remove all pending comments marked as spam (the WP Optimize plugin is great for this)
- disable all comments/trackbacks/pingbacks in the WP Admin (following all the steps here: http://premium.wpmudev.org/blog/wordpress-comments-off/)
- remove all Theme references to
comments_template
/pingback_url
in the active Theme - set archive posts/etc. to disable comments/trackbacks in the database: http://codex.wordpress.org/Combating_Comment_Spam/FAQ#I_have_disabled_comments.2C_but_comments_continue_to_be_posted
- [OPTIONAL] add Theme code to disable comments and access to comments: http://www.dfactory.eu/wordpress-how-to/turn-off-disable-comments/
- Deactive/remove antispam plugins after all steps are completed above. No plugins should be needed if you followed the steps above, but if you need to install a free plugin, [Antispam Bee](http://wordpress.org/support/plugin/
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 characters
<?php | |
// SHORTCODE - Include File | |
// http://www.amberpanther.com/knowledge-base/using-the-wordpress-shortcode-api-to-include-an-external-file-in-the-post-content/ | |
function include_file($atts) { | |
//check the input and override the default filepath NULL | |
//if filepath was specified | |
extract(shortcode_atts(array('filepath' => 'NULL'), $atts)); | |
//check if the filepath was specified and if the file exists | |
if ($filepath!='NULL' && file_exists(CHILD_SS_DIR.$filepath)){ |
OlderNewer