background preloader

WORDPRESS FUNCTIONS.PHP

Facebook Twitter

50 Time Saving Code Snippets For Wordpress - Ahref Magazine. With each passing day, WordPress attracts to its realm new developers due to its mere simplicity and ease of customizing. Snippets is a few lines of code through which one can design the way in which WordPress manifests itself, and since this can lead to a variety of outcomes, I’ve decided to take the time to present an article depicting the most useful codes.

Some will be directly incorporated in template files, while others will be implemented in functions.php . Please remember to always do a complete back-up of your existing files in order to prevent unpleasant events. You’ll also have to make sure to use CSS classes fitting to your website design and structure, and I’m sure that will be easily achieved. You might also like: 1. Add this code to a template to add a dropdown menu that displays all of your posts. 2. 3. 4. 5. 6. You can place the breadcrumb wherever you want by simply calling the function in your template files. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22.

Add Breadcrumb Links to your Blog's SERP Snippet - A Quick Guide - Wow Internet Blog. Rich snippets within the search results can help to increase click-through rates and also make users aware of other content from your website. We have heard loads over the past year or so about Google+ authorship within your search engine snippet, but one extra feature that I rarely hear mentioned is the use of breadcrumb navigation links.

In the image above you can see an article that I recently wrote appear in the SERPs. I have highlighted the breadcrumb link that goes to the Technical SEO category section of the Wow Internet blog. This can be really handy toward getting more of your content in front of users and also makes for a better user experience in general. To actually implement this into your SERP snippet couldn’t be easier! Adding Breadcrumb Link Code to Your Blog There are a few different mark-up languages that allow you to link up your website breadcrumb links to your search engine snippet. Adding Breadcrumbs to your WordPress Blog – The Easy Way Seem easy enough? WP-Mix. Create One Page On Your Website With All Your Social Media Streams.

Social media is important. I know that, you know that. So why do I keep blathering on about it? Well, because understanding how you can best integrate social media into your websites can aid in the success of your site tremendously. Today, we’re going to focus on the numerous ways you can add social media to your WordPress site and the best social media plugins for doing so. Taking one glance at the WordPress plugin repository, I know there are an overwhelming number of choices when it comes to social media plugins. I’ve also broken down this guide into several categories including social media feeds, social sharing, social icons and buttons, scheduling, comments, and content lockers for easier browsing. 50 Best WordPress Social Media Plugins Plugins for Adding Social Scheduling Plugins for Adding Social Feeds Plugins for Adding Social Sharing Buttons Plugins for Adding Image Sharing Buttons Plugins for Adding Social Profiles, Icons, and Follow Buttons Plugins for Adding Social Commenting 1.

Display Blog Posts on any Page (with navigation) By default, your latest WordPress posts are displayed on the home page, with older posts available via post navigation on /page/2/, /page/3/, and so on. In this DigWP post, we’ll explain how to display your blog posts on any static page using a custom WP_Query loop that works beautifully with post navigation.

For example, if you’re displaying a static page for your front page (as specified in the Reading Settings), you may want to display your blog posts separately, perhaps on a custom “blog” page. That’s what I ended up doing for the xy.css blog while using a static (post-less) home page. It’s nice because post-navigation works intuitively, like so: — displays latest blog — displays second page of — displays third page of posts..etc.. As you can imagine, this is super-useful when setting up custom CMS configurations, for example when using the home page as a forum, storefront, or landing page. <? WordPress Custom Fields 101: Tips, Tricks, and Hacks. Using WP_Query in WordPress. Take Control of Your Social Snippets. How to Remove Menus From the WordPress Dashboard. The WordPress codex is full of fun things that you can experiment with.

Have you ever wanted to remove a menu page from the WordPress dashboard to prevent clients getting confused by the settings menu? Blow the dust off of your handy codex and check out the function references for removing menu pages. Continue reading, or jump ahead using these links: Removing Items from the Admin Menu Using Code Here’s what you’re looking for: Replace the menu slug with the name of the php script for the menu item you want to remove. Here’s a quick example. Posts … who needs it? The quick and dirty way to do this one is to add it to your theme’s functions.php file, but that’s only if you’re feeling like a lazy goose.

Don’t worry it’s very easy. First, start with a sample functionality plugin like the one shown below … Sample Functionality plugin.Or … open a blank text file and add information about your plugin … Add your plugin information.Next, add your code: Deactivate the plugin to restore menu items. Tags: Stop Loading Stylesheets And Javascript In Wordpress. In a previous post I wrote about how you can add stylesheets and Javascript files to WordPress correctly by using the wp_enqueue_style() function. By using this function you can make sure that you are not adding the same stylesheet twice, this also allows you to prioritise the order of adding the style sheets. In this article we are going to look at the opposite of this function the wp_dequeue_style() function. As you can guess this function will remove the stylesheets from the enqueue. There is also an opposite function for adding Javascript files to the page with wp_deregister_script() function.

Remove Stylesheets That Has Been Enqueued Wordpress will create a queue of stylesheets to load and will import these when it runs the wp_head function. You can open the plugin and change the code to remove the line where it adds the stylesheet. The other solution is to use the wp_dequeue_style() function in your theme functions.php to remove the stylesheet from the enqueue. Conclusion. Add A CSS Class to WordPress Insert/Edit Link Dropdown | Online Marketing | Kona HI, Loveland CO. WordPress Situation Want to have a way to format a link in the WordPress content editor box using only the “Visual” tab (ie not having to go to the “HTML” tab and manually type in a class for the link.

Solution Add a CSS class to the insert/edit link dropdown menu The Reason Although we (developers and designers) tell our clients that Content Management Systems like WordPress are “really easy to use, you’ll have no problem at all,” we know that pages still tend to get broken…often. So, I’m always looking for better ways to “foolproof” and help my clients add and edit their content using WordPress. When adding link in WordPress’s content editor recently I realized that to format the link the way I wanted (and the way the designer designed it), I was going to have to view the HTML tab and assign the link a CSS class. How To I found some simple, effective information on a few options on the WordPress Support site here (especially kchevalier’s response).

That’s it. Showing menu items to logged in users only | dav3 on wordpress. UPDATE: I have now determined how to extend this to show menu items to ONLY guests. Something I’ve been looking at for a while. I have been searching for a simple way to show particular menu items to only logged in users. I know there are ways of achieving this in php by hardcoding your menu structure within the template for your site, but this involves delving into the source code (which I don’t like doing), and then makes the menu less dynamic to changes.

That is, if you later add a page, you have to re-edit the code to have the menu updated… Until now! I found this the other day (credit reference below) and with a little CSS injection and associating a class with the menu item, we can have the same end-user effect. Firstly you need to determine the name of the ID associated with your menu. Once you have that, now you need to add some code to your style sheet: It’s really that simple! If only I could make this work so that a particular menu item was ONLY visible to a guest! 25+ Extremely Useful Tricks for the WordPress Functions File.