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
-1
votes
0answers
15 views

get a youtube video and covert it to mp3 and uploading it to local media? [closed]

I am searching for any solution or plugin free or premium to buy that I have a website that we will upload to post a youtube video as all media uploaded to youtube and I want to convert it to mp3 and ...
0
votes
0answers
9 views

Duplicate an elementor Post via API

I have a special context right here ! I'm using a java App to manage data. My main goal is to use the wordpress to display information, and use the app to work with data. What i'm trying to do right ...
0
votes
0answers
9 views

How can I get the Second Value from a list of three

I have a short code in my theme's functions.php which fetches the city, state and country submitted by users. Using the code which is below, I want to get and display just the STATE only. function ...
0
votes
0answers
9 views

Fetch ids of live posts only (not posts with other statuses) and change status with a button in candidate dashboard

I have added a button in posts list in candidate dashboard that changes status of all posts to "offline" first, then updates the current post to "publish". I want to do this: fetch ...
0
votes
1answer
17 views

WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field

I need some guidance on making a wordpress posts query responsive to user meta data, and whether it’s possible to do what I want within the query itself, or if further work is needed in the database ...
0
votes
0answers
17 views

How to create a shortcode to return data?

I want to create a shortcode function to get the address, country and zipcode registered in the woocommerce settings. The idea is also to collect other data from Wordpress to make it more dynamic in a ...
0
votes
0answers
26 views

How to let user “register” to a custom post type?

I have made a custom post type for events and stuff (dates) and now i want users of the website sign in/register on a post if they want to attend. With each post there is a limit of people and they ...
0
votes
1answer
18 views

Filter works on last selection but no others

I have been working on a frontend filter using ACF Custom Fields. I can filter by the last selection states. but can't select any other option. Below is my code any help would be greatly appreciated. ...
0
votes
0answers
13 views

Add Buy On Whatsapp Button near Add To Chart [closed]

I want to add a button buy on whatsapp now near add to cart. My code is (I change it from a plugin Buy Now Button for WooCommerce) function sbw_wc_add_buy_whapp_button_single() { global $product; ...
0
votes
1answer
15 views

unregister_setting() vs delete_option() for plugin update

I have a plugin (my first major one) and I have some registered settings that are no longer needed. I would like to have these old settings removed from the database to tidy things up and not confuse ...
0
votes
0answers
19 views

Return multiple results with same short code

I added a function in functions.php and it works fine for one result with a link mentioned in $link however I am trying to display multiple results from similar links with this function. Tried ...
1
vote
1answer
21 views

Custom HTML in specific category single page and its descendant categories

I am trying to insert a "style" in single page of a category and its child categories. .relatednews{display:none}. I inserted the following code in functions.php of Child Theme, but it didn'...
0
votes
1answer
15 views

Overwrite text in a complicated filter hook

I am very new to PHP and WordPress. I have learned only the basics of filter hooks but this one seems to be a bit complicated. I want to replace the text This action will let you pay a deposit of and ...
0
votes
0answers
8 views

Default product image by user role

I would like to replace the default product gallery and the default product thumbnail if user have VIP user role. The vip thumbnail and gallery images are in 2 ACF fields: vip_thumb vip_gallery Now ...
0
votes
0answers
23 views

How to replace ACTION url from original wordpress login form?

I need to replace the action of original wp-login login form: Instead of <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', '...
0
votes
0answers
21 views

Check if almost 10 year old - working code is up to date

I found the following code and tested it on my site. Works fine. But im not sure if the code is up to date because the last few years so much has changed on wordpress. Thx for your feedback and ...
0
votes
0answers
20 views

Problem with create_function

I have a lot Plugins there was create_function depracated, the most i have fixed (Thanks for alle here the help a Newbie to learn coding), but there is on the dont work and i became a Error500. The ...
0
votes
0answers
19 views

how to define a html folder to make it work with WordPress commands

so is it possible to define a folder outside the wp-$folders ? i created a html page and i want to use WordPress hooks and filters in it simply the WordPress PHP syntax im still learning php - and i ...
0
votes
1answer
25 views

<?php the_post_thumbnail_url('medium'); ?> not outputting medium size image URL

I am currently trying to output post thumbnail URL with its different image sizes; to use in ssrcset. My current code is: <img class="productimage lazyload" data-src="<?php ...
0
votes
2answers
38 views

Gutenberg block don't save rich text content

I could not get to work. When published the content the attribute innerContent didn't save. Here is what I tried. block.js // Import CSS. import './style.scss'; import './editor.scss'; const { __ } =...
0
votes
1answer
11 views

Add custom css file after plugin css with Wordpress Child Theme functions.php

I am trying to enque a css file thorugh my child themes functions.php after a specific plugin css file with the handle openpos.bill.bootstrap. Unfortunately the current code does not load anything. ...
0
votes
0answers
19 views

Display suffix according to VAT status

I want the price suffix to change within WooCommerce depending on what VAT status is selected. So for example when I show the prices excluding VAT the suffix should read 'excl VAT' and where the ...
0
votes
0answers
16 views

Confused. How to remove WP_Query $args from AJAX posts loop and make it work?

I am currently working on a custom theme project where I am trying to make AJAX load more function work for custom-post-type, 'product' I just made. I went through a tutorial on internet and got the ...
0
votes
0answers
13 views

Wordpress comments.php conditional

I am new and probably dangerous at editing php. First time posting a question here, don't know if this is too much to ask. I understand if so. I have thrown together a custom child theme comments.php ...
0
votes
1answer
31 views

How to use html inside a functions.php code?

I actually have a little problem while trying to use html inside a fuction code. It is something like this. /* AJAX for Posts */ function misha_loadmore_ajax_handler(){ $args = json_decode( ...
0
votes
1answer
27 views

Hide thumbnail on search results when thumbnail not set - using Oxygen

I am using Oxygen to build a search results page. I am very new to CSS and PHP editing. I just floated an image right for the first time. So please forgive my ignorance. I want to stop the thumbnail ...
0
votes
2answers
21 views

Redirect User Role When on Specific Page

I am trying to redirect user roles to a specific page. If their role is contributor and is trying to access the Users Admin Page they should be redirected. Not sure if I am doing this correctly as it ...
0
votes
1answer
21 views

How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)

I’ve created a plugin for my child theme, in which custom functions are stored. Additionally, within the plugin, I'm also enqueueing stylesheets and .js which control the output of two templates, for ...
0
votes
1answer
16 views

How to Extend login session times to a Month

How can I extend wordpress login sessions to a month so that it doesn’t automatically ask for login after 48 hours? I am basically testing some program with wordpress and around 48 hours it fails and ...
0
votes
0answers
11 views

admin-ajax.php 404 bad request

I created ajax listing for data on my web site. Tomorrow it was worked but today I'm getting this error when the site is calling ajax : jquery.min.js?ver=5.6.2:5 POST https://domain.com/wp-admin/...
0
votes
0answers
10 views

Expand mobile menu on button/link click

How can I expand the WordPress mobile menu on Button/link click? I tried searching online and I can't figure it out. I also tried using CSS classes to see if I can expand the menu on button click. but ...
0
votes
1answer
17 views

WP_Query for Attachments not working as expected

I have a function to retrieve a random set of pictures according to the category. This has been working when I set up the website last year. Now I tested the site today and found out that none of my ...
0
votes
0answers
11 views

My customize pice function is showing price on shop and single product but not on cart page and checkout page

My customize price function is showing price on shop and single product according to function of my custom price but not on cart page and checkout page. Woocommerce is showing no value (blank) on cart ...
0
votes
1answer
20 views

Does size of a theme's functions.php file matter?

I created a custom theme for my website and I'm in the process of updating the theme to work with Gutenberg. So far the file size of the theme's functions.php file is currently 1.9MBs. Does the file ...
0
votes
0answers
10 views

Change post status based on taxonomy

Need help with this code. I want to change status of a post if a taxonomy is Y value. The code I have, based on other I saw for meta fields. //add_action('init','my_hourly_event'); function ...
0
votes
0answers
11 views

Undefined variable issue for wp_get_attachment_image_url

I use below code for profile image in single.php: <?php $author_id1 = get_the_author_meta('ID'); $user_meta1 = get_user_meta( $author_id1, 'shr_pic', true); $mihan_profile = ...
0
votes
1answer
16 views

Customise the WordPress gallery html layout

I want change the WordPress gallery html layout, By default, the output of HTML is as follows: <div id="gallery-1" class="gallery galleryid-184 gallery-columns-3 gallery-...
0
votes
0answers
12 views

How do I add a custom capability to a user role that would allow the user to add/remove specific users and not the entire list of users?

This may be slightly confusing but I will do my best to explain. I am trying to create a capability that would allow a user to add users to our site. They would be able to view and delete these users ...
0
votes
0answers
16 views

How to force one script to load before google tag manager script

I have configured a cookie consent banner called OneTrust to block cookies like google tag manager unless the user accepts the cookies. The onetrust script should load just after the head tag and I ...
0
votes
0answers
10 views

Redux - change options via child theme

I've got a weird issue. I'm working on a theme that uses Redux Framework. Redux is added as a regular plugin, it's options are placed in the theme folder (dir: framework/admin/options/.php). What I ...
0
votes
0answers
11 views

WP User Frontend Enable/Disable Comments

I'm using the WP User Frontend plugin so the users can publish posts from the front end. I want the users to have the ability to show and hide comments for each post individually if they want. For ...
0
votes
0answers
12 views

How to get domain.com/some-random-path to run a bit of code and display the result?

I'm porting a site from Drupal 7 to WordPress, and am kind of a WP newbie. In Drupal, I was very used to using the menu system to set up various paths that, when accessed, would run some code (that I ...
0
votes
0answers
9 views

why my function of woocommerce wordpress only pick first row from customize database table

I have a selection of cities and the price will change according to city selection. I have a customized selection of cities which is coming from the table from the database in front-page-features.php &...
0
votes
1answer
18 views

Change class woocommerce on function.php

I would like to change the woocommerce password reset button class. Is it possible from the function file of the child theme? How can I do?
0
votes
0answers
32 views

Cors headers Ajax

I'm just trying to run a basic jQuery ajax get request on instagram's api. $.ajax({ url:"https://www.instagram.com/page?__a=1", success:function(data){ console.log(data) ...
0
votes
0answers
23 views

Text replace for the whole body tag

currently I am using flatsome theme to build a website and I have to make it work with Accessibility model WCAG 2.0 (Level AA). So, while I passed the check in AChecker. In Wave I have errors like ...
0
votes
0answers
22 views

Bizarre Child Menu Issue on WP Site

I have a bizarre problem that I just can't figure out. I have been fixing this site for almost 3 days with so many customizations that the previous developer did. The structure of this site was ...
1
vote
0answers
9 views

How to enable specific plugin only based around shop manager role?

I have created a nice clutter free dashboard for the shop manager role which gives permissions to edit, maintain the store and hidden unnecessary junk i.e widgets, updates etc The problem: The current ...
0
votes
1answer
20 views

Alternative Hook to the_content for Changing Background Color

I'm brand new at writing WordPress plugins and have tried to find which hook would be appropriate to use when changing the background color for front-end pages. I've tried the_content, stylesheet, and ...
0
votes
1answer
15 views

How to add custom user avatar in wordpress

I use below code for adding media uploader to user edit profile page WP. Now, how to use in for show in single.php page? I have an error in single page: <img src="<br /> <b>Notice&...

1
2 3 4 5
108