default image
Automatic link to blog post page
Add this code to your functions.php file: // Generate Link to posts page function archi_get_post_page_url() { if( 'page' == get_option( 'show_on_front Read more
default image
Automatically number each post in WordPress
In some cases I need to automatically number each post starting with the very first being number one. I’m not talking about using post ID here, Read more
default image
Displaying user info
Get current user’s info: <?php     $current_user = wp_get_current_user(); // set variable     echo 'Username: ' . $current_use Read more
default image
List all the children of parent page
When you visit the parent page, it will list all its children. Visiting the child page of the parent will show its siblings. <?php if($post->pos Read more
default image
Copy and/or move element(s) and display elsewhere
In the below script, the element #shopping-cart is copied (cloned) and then appended to the element #menu-button. jQuery(document).ready(function() Read more
default image
WordPress cheat sheet
This is my WordPress cheat sheet, these are a list of codes I’ve collected over the years for custom theme development. I will try to add explan Read more
default image
List posts by Category
What this does is prints out the heading of each category and lists only the posts in that category. Fill free to alter the loop to your needs, but ke Read more
default image
Add inline javascript to WordPress correctly
Add to functions.php file. Name the add_action whatever. You can also have the script load in the footer by changing wp_head to wp_footer. // Add JS t Read more
default image
Get the current page order number according to WordPress
This is useful for book chapter numbering if you don’t want to manually add the page number of a child in the title or wherever else: Example u Read more
default image
Get the current page and total number of pages in a paginated post in WordPress
<?php global $multipage; global $numpages; global $page; ?> <?php if ($multipage):?> <div class="page-numbering">Page <?php echo Read more