Editing Source Code in WordPress

You don’t want to edit core WordPress code. You don’t need to edit core WordPress code to do what you need to implement. First, you need to study the WordPress templating (i.e. Theme) functionality. Then, you need to study Plugins and the WordPress Hooks API, including its Action Hooks and its Filter Hooks. To do … Read more

Including Angle Brackets In Pre Sections

If you’re just trying to display them in a page or a post, you could try using their character entities. In the Text view in the editor, type &lt; instead of < and &gt; instead of >. So, for instance, in your editor’s Text view (not the Visual mode), you’d type: <pre> private HashMap&lt;String, HashMap&lt;String, … Read more

How do i structure my theme folder to avoid one huge list of files

Not a full answer, but I can at least answer this question: Also custom post template files can not be in sub directories. Everything, that you can load via get_template_part(), can reside in a subfolder: get_template_part( ‘subdir/part’, ‘suffix’ ); It’s as easy as that. Now you’ve your part inside ~/wp-content/themes/theme_folder/subdir/part-suffix.php Slightly off topic. Then there’re … Read more

how to group custom post types

The filter Inside /wp-admin/menu.php, you’ll find this filter at the end of the “add css classes”-loop: apply_filters( ‘add_menu_classes’, $menu ) The function The following code attaches the right classes to the first and previous elements. It also adds the separator in between. If you need to add another separator to the end/after your group, you’ll … Read more

What is this code in my theme’s functions.php? if (isset($_REQUEST[‘action’]) && isset($_REQUEST[‘password’])

Your website has been hacked. This is malicious code that gets triggered from the outside, loading more malicious content from ‘www.dolsh.cc’ domain. If the content comes back after you remove it, then you have hacked files somewhere else that will automatically rewrite functions.php any time page is loaded. You need to find and clean up … Read more

How to get a variable number of posts per post type on the main loop?

If you are still looking for an alternative that may be faster this may help you: <?php function customBlogFeed() { // The Query $the_query = new WP_Query( array ( ‘post_type’ => array( ‘post’, ‘page’, ‘movie’, ‘book’), ‘posts_per_page’ => ‘6’ ) ); //Your post_type array is a list of random post_types. You can add whatever you’d … Read more

Return $post_id when DOING_AUTOSAVE?

The ‘save_post’ action was added to core in 2.0, and has always been an action. Looking through the current autosave procedures, it doesn’t appear to call the ‘save_post’ action directly at any time. So the short answer is, no. There is no reason, and has never been any reason, to return any value on this … Read more