The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Simple accounting system [on hold]

I need to create a simple accounting system in wordpress. We have a medical center and we need to summarize the incomes per doctor daily (or until being reset). We support many services. We need to ...
0
votes
0answers
22 views

Gravity Forms Populate Fields From Another Field [on hold]

I have a Gravity Forms form with multiple pages. Page 1 asks for a store #. I want page 2 to auto-populate meta information from that store (which is set up as a user using role "shop") using a ...
0
votes
1answer
14 views

Show image after X para - center aligned

I am using this code in wordpress functions.php to display featured image after 1st para. The problem is: Image is showing left-aligned. I want it to be center aligned.. Please modify this code so I ...
-1
votes
0answers
13 views

Automatic Email a Data [on hold]

One of my website has php page which actually functioning for tracking of my website data now this functionality leads me to very heavy database space in around mbs in just week so i wanted to ...
-2
votes
0answers
21 views

Horizontal devider Between every post

Like below picture..... Here is my code <?php /** * Block 1 Widget * Class Glob_Widget_Block1 */ class Glob_Widget_Block_1 extends WP_Widget { public function __construct() {         $...
0
votes
1answer
31 views

Remove 'page-numbers' class from prev and next tags

I'm converting a template to WordPress theme and i need to change some css classes. The WordPress function paginate_links generates this markup: <ul> <li><a class="prev ...
0
votes
1answer
22 views

WooCommerce - Reset quantity input field when variation changes

Is there a way or a plugin to reset quantity input field every time a user changes the variation? I searched but i didn't find something similar or any hook. I tried the following jQuery event but it ...
0
votes
1answer
18 views

Re-style Login Form Whilst Keeping CSS Separate from Frontend CSS

I'm changing the appearance of the WP login page for a client and I'm using CSS in addition to the following code in my functions.php file. // CUSTOMIZE LOGIN SCREEN add_filter('login_headerurl', '...
0
votes
2answers
28 views

How to change this simple code so that it sends the email notification after payment in WooCommerce?

How to change this code so that it sends the email notification after successfully payment in WooCommerce? add_action( 'woocommerce_applied_coupon', 'custom_email_on_applied_coupon', 10, 1 ); ...
0
votes
0answers
20 views

Fatal error functions.php page

Would anyone know what I'm doing wrong (using Dreamweaver editor) I get this error on my functions.php file when I preview and test. Any help or guidance would be very much appreciated!! Fatal ...
0
votes
0answers
12 views

How can I make the sticky pricing table in Divi theme without plugin?

I need to make a pricing table top row sticky relative to that pricing table main div like this Demo with javascript code or jquery code. I am using Divi theme where CSS position sticky is not ...
0
votes
1answer
11 views

SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php

Major issue with my search queries being outputted incorrectly on the blog page with respect to query's. In wordpress admin most relevant listed first but outputted DESC on page. I have this code in ...
0
votes
0answers
21 views

Wpadvancedsearch multiple taxonomy category problem

I using wpadvancedsearch and i using multiple taxonomy for category in fields My functions.php code: function my_search_form_home() { $args = array(); $args['form'] = array( 'action' ...
0
votes
1answer
12 views

Using Static HTML instead of the `home_url()` WP function

When I add links to pages in a custom WordPress theme I use the following function: href="<?php echo esc_url(home_url( '/contact-page' ));?>" If I don't use the home_ur() function, but the ...
0
votes
1answer
12 views

How do we display a certain category type on a page while hiding all others?

We need to hide a specific category type on all pages but one, and then display that hidden category on a singular page. So far, to hide the category on all pages, we have coded this: // Exclude ...
0
votes
1answer
14 views

Can You Set A Minimum Image Dimension For Resizing Images?

This seems like a simple request but I can't find how to do it anywhere. Using add_image_size you can designate maximum width and/or height for an image to be cropped or rescaled but I can't find how ...
0
votes
1answer
21 views

How to create an array if 'empty'?

Sorry if this is super "newbie", but I'm stumped. I'm trying to create a function in WP All Import that states if the cell is empty it populates with "Not Specified". Please see below: function ...
0
votes
1answer
30 views

Woocommerce - if selected attribute term equals

I have created an attribute "color" with two terms "black" and "white" and i want to show something when selected term equals to white. I've tried the following code (based on https://stackoverflow....
0
votes
0answers
17 views

Display Specific Parent and Child Category Lists with Format

I have a code that I want to display in lists. <nav> <ul class="simplefilter filter-port"> <li class="btn active button btn-hover" data-filter="all">All</li> ...
0
votes
1answer
9 views

split 1 cart item into instock and back ordered

If I have a stock count of 2 and I allow backorders and a client adds a quantity of 5 to the cart, the cart shows 1 line item with a quantity of 5 on backorder. Is there a way to split this cart ...
1
vote
1answer
17 views

retrieve current user meta data (custom fields included)

I use "User Registration" plugin to create a registration form. Once the user has registered and logged in, I need to retrieve inside "Function.php" all his data that he completed in the registration ...
-1
votes
0answers
17 views

How to save $_POST['acf']['field_X'] data from a custom form?

I have a User Submitted Posts form in which I've included my ACF field group. $_POST['acf']... includes data submitted via form and with USP filters I can hook into newly created post/article which ...
0
votes
0answers
22 views

wp_title() return random number

wp_title() function return only one integer, 27 to be specific. On all pages it works great but one. Before I changed title it was returning 'false', further changes make no difference. Place where i ...
0
votes
0answers
16 views

Problems adding a new field to product in cart

I have a problem and it is that I need to add a new field in the product form, and that I can obtain it in the cart page and also in the checkout. After trying it on my own, I decided to googling a ...
0
votes
1answer
19 views

How to bind each “the_content” elements to a custom variables

I'm implementing bootstrap theme into wordpress and i need you'r help. In Wordpress i created a simple page with paragraph and a list of 3 item's. Product list one Product one - Link Product two - ...
0
votes
1answer
19 views

If Array Values Match Another Array's Values, Then

I have a user drop-down field that includes High, Medium, or Low ranking. Each ranking has three requirements for evaluation types. I also have three additional drop-downs with options to choose ...
0
votes
1answer
29 views

Show some menu sub items as dropdown under a menu item

I have made a custom wordpress menu - function my_custom_menu_item($items, $args) { if(is_user_logged_in() && $args->theme_location == 'primary') { $user=...
0
votes
1answer
10 views

post_exists stops working in a scheduled event

I am creating a wordpress plugin that takes an article from one of my wordpress sites and then posts it to different wordpress site. For testing purposes, I want it to pull an article at random and ...
0
votes
0answers
10 views

post id or permalink auto-incrementing number and reset everyday

i wanna have a permalinks like this: *.com/2019/10/02/0001 *.com/2019/10/02/0002 *.com/2019/10/02/0003 ... *.com/2019/10/02/nnnn . and the next they the number should be reset to 0001, and ...
0
votes
1answer
57 views

A non-numeric value encountered in /wp-includes/functions.php on line 68

We recently updated our shared hosting to use PHP 7.3 (problem still existed in PHP 7.2 as well) - website is throwing the error in the title. the function in question is: function current_time( $...
0
votes
1answer
8 views

Auto Resize embedded videos player

Hi I am importing videos through xml feed - But from one source, the video player is too wide and the sidebar ads overlap it. The code I found on the single.php is <div class="video_player"> &...
0
votes
1answer
31 views

Prevent shortcode from being wrapped in <p> tags

I'm using a latex plugin to display formulas on my wordpress site, and I would like to add shortcodes with formulas inside them, so the content of the shortcodes must be processed by the plugin before ...
0
votes
0answers
9 views

WooCommerce - Unattach ALL products from a specified category [closed]

Woocommerce - remove product from category talks about unattaching one product from a category within WooCommerce. Lets say I have a Computers parent category and it's child categories are Intel ...
0
votes
1answer
21 views

Remove unwanted elements for a wp_nav_menu

I am working on building a custom mega menu within Wordpress.I am running into an issue with unwanted elements being displayed from wp_nav_menu which are distorting my menu. <?php wp_nav_menu( ...
0
votes
0answers
23 views

Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”

I created a plugin to add a new stock status to my woocommerce products. I used this as my reference (copy and pasted into my plugins php file): Create WooCommerce custom stock option that is non-...
0
votes
2answers
22 views

ACF field key/value to show on taxonomy list

The title might not be 100% spot on, but let me illustrate what I mean: I have a custom taxonomy (doens't matter if taxonomy of post-type), and ACF fields registered on the taxonomy. It all works ...
-1
votes
2answers
8 views

Setting WooCommerce currency programmatically

I have an issue where I need to change the currency programmatically. I am doing an AJAX call and I have noticed that returned results does not take into account which currency the user has set. So I ...
0
votes
0answers
15 views

Permalink changes after several minutes after saving post

I once created a script for a website of mine that looks at who (which author) saves the page. Based on this information, a script ensures that the page that this author creates is automatically saved ...
0
votes
1answer
20 views

How to append classname to body tag if guest user

By default when a user is logged in, a 'logged-in' classname is appended to the body tag. I need to append something like 'guest-user' to the body to output different styling based on whether or not ...
0
votes
0answers
9 views

Function to put profil at the top after each conection

We have a directory, each user have a "suscriber role" to manage their profiles and ads, but they don't have a look on WP-admin. We would like that each user who connect on our his own profil make ...
0
votes
0answers
8 views

How to relate Two Different Users from Two Different Roles in Wordpress

How can we relate two users in wordpress that are from two different roles. For example: I have created two roles; Role1: Manager Role2: Sales Users in Manager: Manager will be having multiple ...
0
votes
0answers
19 views

blank page with wp_get_attachment

I want to use the function "wp_get_attachment" but when I use it, my website shows me a blank page while my server locally, the function shows me what I want... I went through the canvas without ...
0
votes
1answer
60 views

How to add javascript code into Divi child theme?

I want to add this JavaScript code into my Divi child theme. I have made a directory for the js file inside the Divi child theme folder. The name of the js file is "selectpage.js". <script type="...
0
votes
1answer
22 views

Can site visitors view functions.php file?

I'm pretty sure the answer is "No, they can't see functions.php or any theme php files" but I can't find an answer anywhere.
0
votes
1answer
12 views

restrict incrementation of post vies count when refreshing the page

I use a post views counter to save post views - function calculatePostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ ...
0
votes
0answers
37 views

Permalink Rewrite Rule Issue in CPT

For a custom post type blog in my site, I want to have the following permalink structure: mysite.com/blog/post-slug/post-id I am using the following code in my theme: function blog_links($...
0
votes
0answers
26 views

Add file extension to function wp_get_attachment_image_srcset()

The function wp_get_attachment_image_srcset() delivers the srcset information of an image. Is it possible to write a seperat function to add an additional extension (.webp)? Output of the function ...
0
votes
1answer
20 views

Customize Add to Cart Button on single product with variable prices

Customize Add to Cart Button on a single product with variable product. In my themes woocommerce folder this is the hierarchy of the file → I have used the same hierarchy as in the woocommerce ...
0
votes
1answer
22 views

Merge two search functions for custom post type

In addition to the site-wise search. I have a custom search for a certain post type and with different ordering than the global search. Here are the two function, which works. I wonder if those two ...
-1
votes
0answers
13 views

Function create_function

Deprecated:Function create_function() is deprecated in /nas/content/live/syn1/wp-content/plugins/foobar/includes/WP_PluginBase.php on line 822