Goal: To hide specific categories from showing in the post meta area The below code achieves that (which is in the theme’s functions.php file): function exclude_these_categories($thelist, $…
Tag: function
WP All Import Pro Function To Change Date And Time Format (From Imported .CSV)
I have a .csv file which I import in my WordPress website using WP All Import Pro. Everything works fine but since I need the date to be in a different format then it comes in the .csv, and seperate …
PHP looping through a function before returning value
I have simplified this. I have this line of code in a method in a (codeigniter framework) controller: And this is is the ‘loop1’ function: What I need to be able to do is loop through loop1 function until certain conditions are met before then returning the results array. Problem is calling the function again at the end of loop1
How can we display current user display name with shortcode?
I got this shortcode function to work to show current user display name, but now for some reason it is displaying the user’s first name. Is there another way to get current user’s display name and output it with shortcode? Answer If you go to a user’s profile (User’s > All users > search for the user you want) then
PHP function working differently for return and echo. Why?
By using the following class: and Calling the function, by the following code, it works fine. But if in the SafeGuardInput class if I replace echo $finaloutput; with return $finaloutput; and then echo $forminput; on the index.php page. It DOES NOT WORK. Please provide a solution. Answer You can’t return anything from a constructor. The new keyword always causes the
Gravity Forms add attachment to user notification
I am using the following code from Gravity forms to attach a file to the user’s notification: add_filter( ‘gform_notification_55’, ‘add_attachment_pdf’, 10, 3 ); //target form id 2, change to your …
Why can’t I use a function to simplify my “for loops”
I build a webpage to crack simple MD5 hash of a four digit pin for fun. The method I used was basically try all combination and check against the MD5 value the user has entered. Below is the PHP code I created to accomplish the goal. Debug Output: Notice that in the middle there are four very similar for loops,I
PHP Global array in function into class function?
my class (posts.php): class Posts { private function getPosts() { $get_post = (new MYSQL) -> getAllPosts(); // here get all posts from my db $GLOBALS[“all_posts”] = $get_posts; function …
PHP function that auto imports all CSS files from a certain directory
I’m working on a website that has 6 CSS files at the moment. I want to make a php function that scans a directory and load all the CSS files in de HTMl head. I got this working on the index page, but …
User variables of a function, in another function
I have a Laravel app, which the following PHP code: public function handle() { $post_item->category_id = $source->category_id; $…