Skip to content

Instantly share code, notes, and snippets.

digitalinkwell

Block or report user

Report or block digitalinkwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View postviewentrymeta.php
<div class="entry-meta">
<?php twentythirteen_entry_meta(); ?>
<?php
// adding page views after Meta Information
$post_id = get_the_ID();
$pageviews = get_page_views($post_id);
echo "$pageviews Views.";
// end of views
?>
View getjetpackpostviews.php
<?php
// extract JetPack pageviews
// courtesy of Topher: http://wpgr.org/2013/03/02/rendering-jetpack-stats/
function get_page_views($post_id) {
if (function_exists('stats_get_csv')) {
$args = array('days'=>-1, 'limit'=>-1, 'post_id'=>$post_id);
$result = stats_get_csv('postviews', $args);
View postviews.php
<?php
// function to display number of posts.
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
View dashboard-instruction-widget.php
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'My Dashboard Widget',
View hide-author-usernames.php
add_action(‘template_redirect’, ‘bwp_template_redirect’);
function bwp_template_redirect()
{
if (is_author())
{
wp_redirect( home_url() ); exit;
}
}
View block-ip-address.php
order allow,deny
deny from 456.123.8.9
allow from all
View restrict-wp-login-access.php
<Files wp-login.php>
order deny,allow
Deny from all
# allow access from my IP address
allow from 192.168.5.1
</Files>
View restrict-admin-access.php
order deny,allow
allow from 192.168.5.1
deny from all
View hide-wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
You can’t perform that action at this time.