If you are developing your own WordPress theme, or would like to add a menu elsewhere in your site, you may use the wp_nav_menu(); function to display a specific menu that you’ve created using its name. Let’s say you have created a new menu called “Sample Menu”. Under that menu, you have added the pages…
Category: Programming and Coding
Why Use Python Over R. And Why You Might Not Like R At All.
Python has a wider range of applications, to start. In addition to a plethora of other tasks, such as web server and advanced UI design, you may perform data science and statistics similar to those in R. Simply put, there are more users as a result (more fields = more users = more resources). With…
How To Fix “Warning: Creating default object from empty value in…” In WordPress
If you’ve encountered this error message in your WordPress site, it is most likely that you can’t create a new post. You can’t create a new page or even upload media. That is because there is an issue with the website’s database. This error can look similar to this “Warning: Creating default object from empty…
Fix WordPress “Warning: Cannot modify header information – headers already sent by…”
If you’ve encountered this error message in your WordPress site, it is most likely that you can’t create a new post. You can’t create a new page or even upload images. That is because there is an issue with the website’s database. This error can look similar to this “Warning: Cannot modify header information –…
Solved: Changing the ‘Publish Date’ does not update post order in WordPress
Changing the publish date of a post in WordPress should also automatically change the post’s order in the loop. Depending if the post loop is set as Ascending or Descending, the post should show accordingly by its new date. But if it’s not working, try these steps to fix the problem. 1.) Check the code….
Sample Code of a “Related Posts” Loop in WordPress. With Post Thumbnail, Category Name, and Post Author
For most publisher websites, it’s often a great idea to show your readers other posts that are related to the article they’re reading. A great way to do this is to add a “Related Posts” section at the bottom of the article that lists a few more related topics. Some WordPress themes might not have…
Loop Google Maps Markers and Coordinates from WordPress Posts
This article is for you if you’re trying to figure out how to render a Google map in your WordPress website, with multiple markers where the coordinates are coming from the posts or custom post types. Scenario: Let’s say you’ve created a custom post type called “Restaurants”. You have custom fields in that post where…
How to Display the First Full Paragraph of a Post as the Excerpt in WordPress
WordPress has a build-in PHP function called “the_excerpt()” which calls the excerpt under your post’s settings (seen at the right side of a post’s editor). If that Excerpt field is empty, WordPress will call a trimmed down content of whatever is in the beginning of your editor. It might not be appealing especially if it’s…
Display 3 or more Posts per Row using WordPress Loop
There might be an occasion where you’d like to have your WordPress posts be displayed in columns within a Bootstrap “row” like the image below. You can do it whether it is in columns of two, three, or more. Simply copy the sample PHP code below to generate the same column and row layout in…