Blog – Page 39

Twitter Share Count for a WordPress Post

10 Ways to Get Post ID

I decided to create this super-detailed tutorial so it would never be a problem for you to find out any post ID. When I say “post ID” I also mean pages, custom post types and WooCommerce products and orders.

3 Ways of Getting Shares for URL using Facebook 3.0 API

Pagination for Custom Loops

There are different ways to create a pagination for WordPress posts in a loop:

  • Using next_posts_link() and previous_posts_links() functions
  • Using paginate_links() or get_the_posts_pagination() that allows to display numeric pagination.
  • In old times we also used plugins for that purpose, the most popular was WP-Pagenavi.

In this tutorial my goal is to show you how to create any kind of custom paginations for almost anything. For example did you know that do display page numbers in Appearance > Menus is also used paginate_links() function?

custom pagination in WordPress nav menus

How to Create AJAX Filters

In this tutorial I am going to guide you step by step through the process of creating WordPress AJAX filters and I am about to show you two examples – at the first one we will create a simple post filter by category and in the second example we will dive deep into WP_Query in order to create a complex search filter with a couple of custom fields.

In our examples we’re also going to use:

  • Pure JavaScript on the front-end. I know, many of you guys don’t like jQuery and since it is not a filter for a WooCommerce store and the library isn’t included in the front-end by default, there is no real reason to use it.
  • A default “Twenty Twenty” WordPress theme. We can not use latest themes like Twenty Twenty-Four, because the latest themes are block themes and in that case we will need to create a Gutenberg block for our filter which is a completely different story. By the way, if you’re interested in such a block, please let me know in the comments below.

Let’s get straight to the AJAX filter examples now.

How to Use Image Uploader in WordPress Admin Area

In this tutorial I am going to dive deep in WordPress media uploader functionality. By the way it is possible to implement not for only images but for any supported file types.

This is how it looks in WordPress admin area:

Image uploader field in WordPress option pages
Below in this tutorial I will also describe how to create a settings page like this.

Custom Plan Settings Tabs in WooCommerce Memberships

In this tutorial I would like to share with you how I figured in out the way of creating custom settings tabs on “Edit Memberships Plan” pages.

I needed to add a custom tab there for settings of my Simple Mailchimp Sync plugin.

And right now in this tutorial we are going to create a simple tab like this:

Create a custom plan settings tab in WooCommerce Memberships

The good news is that WooCommerce Memberships plugin is customizable with hooks, actually there are two of them we need:

  • wc_membership_plan_data_tabs – allows to filter an array of tabs, remove or add items into it.
  • wc_membership_plan_data_panels – this hook will help us when we need to display HTML of our tab.