How To Add Dynamic Copyright Text In Your WordPress Website
Adding the following snippet to your theme’s footer.php file will let you add dynamic copyright text in your WordPress website.
1 2 3 4 5 6 7 8 9 10 |
<b>(c) <?php echo date('Y'); ?> </b> | <a href=" <?php bloginfo('url'); ?> "> <?php bloginfo('name'); ?> </a> | <?php bloginfo('description'); ?> |
Snippet Source/Credit: WP-Snippets.com
How To Change Admin Logo In WordPress
Adding the following snippet will let you change admin logo in WordPress.
1 2 3 4 5 6 7 8 |
<?php function custom_admin_logo() { echo '<style type="text/css"> #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; } </style>'; } add_action('admin_head', 'custom_admin_logo'); ?> |
Snippet Source/Credit: WP-Snippets.com
How To Check If User Signed-In In Your WordPress Website
Adding the following snippet will let you check if the user is signed in or not in your WordPress website.
1 2 3 4 5 6 7 |
<?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visitor!'; }; ?> |
Snippet Source/Credit: WordPress Codex
How To Create A Template In WordPress
Adding the following snippet will let you create a template in WordPress.
1 2 3 4 5 |
<?php /* Template Name: Cool Home Page */ ?> |
Snippet Source/Credit: WP-Snippets.com
How To Display Number Of Posts In WordPress
The following snippet will let you display number of posts in WordPress.
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php // All pages $total = wp_count_posts()->publish; echo 'Total Posts: ' . $total; // Pages with a category $categories = get_categories('exclude=1,2,3'); foreach($categories as $category) { $total += $category->count; } echo 'Total Posts: ' . $total; ?> |
Snippet Source/Credit: WP-Snippets.com