Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [functions]

A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

0
votes
1answer
41 views

Loading two different AJAX requests on two different pages

I hav ebeen trying to call two separate AJAX requests, on separate pages, each pulling in their respective parts. Right now, it only pulls in ONE of the AJAX requests on both pages even with specific ...
0
votes
0answers
13 views

how to make Wordpress DB lookup code to do “if” funcation

I have a wordpress website that using WPUM to creat accounts and mange them and a coustem plugin for memberships. When users creat an account they chose from membership plugin membership kind ( Sun - ...
0
votes
0answers
166 views

How to override WooCommerce Order Item Meta with data from Cart?

I have the following function that is overriding some of the values that are saved to the Cart and Checkout, via the YITH Bookings plugin. Essentially, I have overridden the Duration field with my own ...
0
votes
1answer
15 views

Strip all HTML tags from product content and resave

My client has loaded about 500 products into Woocommerce, but has inadvertently pasted in a stack of extra tags into the product description- divs and spans etc like below: <div class="summary ...
0
votes
1answer
20 views

Auto remove tags on certain date

I was wondering how could I automatically remove a tag from a post on a certain date? Let's say I have a tag called "upcoming", I would want functionality where I could type in a date and on that date,...
0
votes
1answer
27 views

Get first URL from post content

Basically all I want to do is if the post format is "link" rather than link to the post from the blog index, link to the link pasted within the post content. In my index.php I have: <h3> <...
0
votes
1answer
40 views

Calling hooks in functions

I'm comfortable with theme hooks, regularly add features, but struggling with a plugin hook, to filter content. It's at the limit of my knowledge, and I'm trying to understand the process, to no avail....
0
votes
0answers
10 views

Listing variable products as individual products?

Is it possible to list variable products as individual products? If this is not clear. Same question but different phrase:- Split variable product into single products while listing it. Kinda hard to ...
0
votes
2answers
20 views

multible shortcodes (for differnt values) with one function

I am trying to create a function whicht has different shortcodes as output. I have the post-type => womos and the field => personenzahl. The field has the values 1 up to 7. Now I need a shortcode for ...
0
votes
0answers
44 views

How to add class dynamically from templates

I would like to add dynamic classes from templates to tags like <main>, <header>, <footer> which are defined in header.php and footer.php. This is something I would like to acheive: ...
0
votes
1answer
59 views

Call to undefined function get_userdata() in plugin

After refactoring/restructuring files in my plug-in, I now get the error Uncaught Error: Call to undefined function get_userdata() after code $current_user_id = get_current_user_id(); $...
1
vote
1answer
24 views

Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products

So, like the title says, I am looking for a way to override the setting that makes a products that is out of stock not purchasable. I know I am supposed to use the "allow on backorder" setting to do ...
1
vote
1answer
18 views

Ajax posts filter by date, comments, top views, top likes

I'm trying to create a simple Ajax posts filter, It's working with date and comment but not working with the top views or top likes. So, how can i make the isset( $_POST['top-views'] and isset( $...
0
votes
0answers
14 views

Is it possible to remove original src from wp_calculate_image_srcset() results?

Was just wondering how one could load a custom srcset stack. I know the srcset loads all registered sizes so I'm good on that side but I cannot find a way to remove the original src from there without ...
0
votes
2answers
40 views

How to turn off email you receive when registered?

My client wants to turn off the email you receive when register.
1
vote
0answers
18 views

Wordpress website Rs changed to currency symbol

I have a wordpress blog website and all of a sudden in all of our blogs Rs has been replaced with a hindi currency symbol. I have tried checking out theme settings or any update in code which ...
-2
votes
1answer
44 views

How to insert the first letter in uppercase [closed]

short question, I have a variable concatenated with a get_the_title and get_the_category, and I need the get_the_category to show the first letter in capital letters. <?php echo get_the_title().' ...
0
votes
1answer
24 views

Adding additional roles on registration

I'm trying to add an additional role for a user when they register if they register as a specific role. Here is my function: function add_secondary_role( $user_id ) { $current_user = ...
0
votes
0answers
28 views

JQuery modal not loading video on popup, only displaying it after multiple reopenings

I am trying to load a PHP function into a modal, containing a video. I'm currently using jquerymodal.com's plugin to achieve that. Here's the current .js code I'm using: https://jmp.sh/v/...
2
votes
2answers
59 views

How can I rename the WordPress AJAX URL? [duplicate]

I'm currently looking for a way to change / hide the default WordPress admin-ajax.php URL. I want to do this to remove the admin from it to prevent misunderstandings by my customers when I use the ...
0
votes
1answer
26 views

Where do I go to edit this area? [closed]

I need to edit the area shown in my photo. I am using a child theme. I am unable to ask the question to the theme's website as I don't have a proper subscription. I have tried looking at both the ...
0
votes
1answer
24 views

Setting user nickname and displayname to shortened email

I am trying to set the user's display_name and nickname to the first part of the email address of a user (before the @) upon login if nickname is not set. So far I've got: add_action( 'wp_login', '...
0
votes
2answers
14 views

Insert Modal on user first login

Attempting to create a Welcome Modal for first time users on initial login to my Multisite network. I'm using code from this tutorial https://wp-mix.com/wordpress-first-user-login/ I can see the User ...
0
votes
2answers
22 views

WordPress Ajax filter: Create two loops for different output styles?

I have two different pages, with filters. Those two pages, have different layouts and styles. I have three different filters for one page, where the output and style is the same. For the “newsfilter”...
0
votes
0answers
12 views

Use domain as siteurl on front end and IP as siteurl in back end

When I set the siteurl to the VPN protected private IP, the backend loads but the frontend doesn't and that is because they don't have access to the VPN to be allowed to load the IP. When I set the ...
1
vote
3answers
30 views

Display a text message if the field is not found and not if found

I am trying to display a message like "Sorry no information here" if a field is not found and if field is found, no message should appear. I am using the ACF plugin for displaying fields on the front ...
2
votes
0answers
21 views

Contact Form 7 - Delay auto responds

I'm looking for a way to delay the auto response (mail_2) from Contact Form 7 for 2 days. But I have no clue how to tackle it. I hope you have an idea. I'm using the following code in functions.php ...
2
votes
1answer
31 views

Display a text message if the shortcode is found?

For a few hours I try to show a message only if there is a gallery Picu, without success, an idea? Have try this code, but not work: /** * galeries content */ function ...
0
votes
1answer
114 views

add_query_arg not work in admin

I have code: class some{ public function run(){ add_filter('query_vars', array( $this, 'addPar')); $this->some_body(); } public function addPar($vars){ ...
1
vote
1answer
81 views

Replacing a plugin function with a custom renamed function doesn't work

With WooCommerce and WooCommerce Bookings plugins enabled, I am trying to add a text line above the product time picker section to advise the customer that they need to select one of the options. I ...
0
votes
0answers
17 views

Taxonomy Child Term, Counter is staying on 0

I'm stuck on the counter for the child term. See Image: What did i try? Make use of: wp_defer_term_counting(true); wp_update_term_count(); Both of this functions didn't work inside my code. ...
0
votes
0answers
10 views

Child Theme Functions Statement

I have the following code from a theme file ... function samatex_enovathemes_post_body($blog_post_layout,$blog_post_excerpt){ $post_format = get_post_format(get_the_ID()); $link_url =...
0
votes
2answers
40 views

Remove Jetpack infinite-wrap

I'm trying to remove the infinite-wrap class jetpack adds to posts with infinite scroll turned on because I want to add infinitely loaded posts to a gridded layout. I found the article here that says ...
1
vote
1answer
97 views

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

I’m trying to change the svg of the ellipses for the mobile menu. It’s called in this file: template-functions.php so I did a hook on my child theme functions.php to replace it, like so: function ...
1
vote
1answer
19 views

How to get specified parent page title in my function

Below I have a function that prints the child pages of a parent. I am trying to obtain the specified parent pages title as a h2 above the unordered list. I have tried updating the title_li and also ...
1
vote
1answer
24 views

List child pages of specific page using shortcode

I have written the function below to list the current pages child pages. Now what I am trying to do is list the children of a specific page using its slug in the shortcode. Is it possible to sneak an ...
0
votes
1answer
46 views

Add element after navigation element title don't works like I expect

I'm currently trying to add an empty <span> after every item title in my navigation which has childs. So only dropdown elements. Sadly also some of my non-dropdown items getting a <span> ...
0
votes
1answer
18 views

Images with overlay

I have some images in a container that I would like to add an overlay and an icon. This doesn't work out of the box, but I found some code that helped: HTML: <div class="main"> <span ...
0
votes
1answer
60 views

How can I count ACF sub_field with a certain value

I have a sub field that have several different values. What I'm trying to do is count the number of rows if they're equal to Mayor. So my code looks like this: if( have_rows('candidates') ): ...
2
votes
2answers
114 views

Using a function written in my functions.php file within the header.php file

I have been asked to do some work on a site where the old developer has written this function (create a variable that stores the users avatar into an img tag) into the functions.php: add_filter('...
0
votes
0answers
47 views

I want to view PDF files in attachment page (attachment.php)

I want to view PDF files in attachment page (attachment.php) When uploading a PDF file it is not reviewed but appears as a link to download
0
votes
1answer
11 views

how to move a page from one drop down menu to another drop down menu

I have a page that is posted under one heading but I want to move the whole page to another drop down... for example from 'FOR SALE' drop down to 'RESULTS' drop down
0
votes
0answers
129 views

how to skip plugin functionality for few pages?

I am using a plugin which count number of views and restrict user with specific level to view limited posts. For example user with level 1 can view three posts or pages every month after viewing three ...
0
votes
0answers
26 views

How to check from which page the user is coming to the current page?

Is there a way of doing this with WordPress aside from using $_SERVER['HTTP_REFERER']? Maybe something like a blend of $_SERVER['HTTP_REFERER'] and is_category(). Something like, came_from_category( ...
0
votes
0answers
10 views

Limit The Character's Length In Pirate Form's Message Field In WordPress

In my WordPress Website, I am using Pirate Forms Plugin for showing a contact form on my Website. It works fine and everything is ok. However, I want to allow my users to be able to put a limited ...
5
votes
2answers
68 views

Using OOP plugin's methods throughout the website

I'm making a plugin for a website, which methods I'd like to use in a few different places, such as page templates, shortcodes etc. I don't want to make the plugin class global or create more than ...
0
votes
0answers
15 views

Can we execute a function when Gutenberg block is added?

I'm wondering if there is a way to execute a function when a certain block is added in the editor, but not each time we edit the block. As far as I know the only functions we can specify are edit and ...
0
votes
0answers
14 views

Pagination not working — custom theme code

I am a "null" when it comes to PHP and I need help fixing this code. Don't have support for the theme anymore. Page affected: truustudio dot com/journal if ( ! function_exists( 'lobo_pagination' ) ) {...
0
votes
1answer
24 views

Site title not showing. Please help me

Please help me, My WordPress site's title not showing. It's just displaying the domain like, www.example.com. site: https://happyygarden.com Please check my site code and suggest how to display the ...
1
vote
0answers
22 views

Why ajax doesn't work on certain wordpress hooks?

I built an ajax function which works perfectly when i hook it to admin_head or admin_notices hooks but it doesn't work when i hook it to manage_posts_extra_tablenav hook, instead of doing the ajax ...