Articles of filters

Pass info from functions.php to plugin

What is the best way to pass some information from functions.php to a plugin? I need to give a user the ability to pass a piece of data from their functions.php file to my plugin. (It can be any data, just something that I can check for; it can be a variable’s value, or even […]

How to use return in my custom function instead of echo

I’m creating a function in functions.php with a custom hook, and from what I’ve read somewhere, it’s good practice to return instead of use echo in a WordPress function? Correct me if I’m wrong. Anyway, so with echo, my function works, but breaks everything else. With return, the function is no longer outputting anything, but […]

Variables in post title

How can I make my post title dynamic? Let’s say I’m trying to make a post with this title: Today is [day]/[month]/[year] [day] should be parsed into a php code that will retrieve the current day, and the same idea for [month] and [year]

Admin Posts Table Column Fitlering is not working for Custom Post Type

I have lot of posts in my custom post type. I want to filter it when I click on my post category. as like the following image. Here is my code to add it on click links. function my_custom_columns($column){ global $post; $custom = get_post_custom(); switch ($column) { case ‘ticketcat’ : echo get_the_term_list($post->ID, ‘ticketcat’, ”, ‘, […]

body_class filter – Is there a better way to write this code?

I would like to add a body class depending on what sidebars are active, and a body class if my before-header widget area is active. I have got it to work, but I would just like to know if there is a better way to write it as my before header widget area function for […]

Adding multiple taxonomy filters to functions.php

I need to add multiple taxonomy filters to the functions.php file to remove (3) irrelevant taxonomies from the Yoast SEO sitemap index. I have been able to successfully add one filter, but when I add the other two filters, I keep getting a 500 server error. I should note that I am a novice when […]

how to change appearence of the content of default post list columns?

Speaking about backoffice here. I usually add columns and filters to the backoffice for certain custom post types. No problem here. BUt what if I would simply like to change something on the content of the default columns? For example, how to change the color of the post titles? And say, only some titles on […]

Archive filter disappears on no results?

I have been working through this example: That a colleague of mine found for creating a simple checkbox-based filter for WordPress custom posts, that filters by a custom post type. I’ve got it all set up and it seems to be working here – , if you filter by ‘Place’ then the ‘All Locations’ […]

WooCommerce: Add Payment Gateway Field to Webhooks

I have created a custom Payment Gateway for a special EFT system we have setup. The Bank Account and Routing Number are supposed to get encrypted then sent to a Salesforce via the WooCommerce webhooks to be processed. Unfortunately, I cannot figure out how to add the Bank Number and Routing Number as line-items to […]

WordPress Social Login > Post to a users Facebook wall

I’m trying to post to a currently logged in Facebook user’s wall/timeline. I found this on the plugin authors github documentation: I put the second snippet of code (the Facebook code) in my functions.php file. Then on one of my wordpress template files, I did this: apply_filters(‘wsl_hook_process_login_before_wp_set_auth_cookie’, get_current_user_id(), “Facebook”, ???); The thing is, I […]