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 [php]

For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.

0
votes
1answer
12 views

Problem changing from PHP 5.6 to PHP 7.2

I have a problem with an old theme that can't be updated. My hosts (1&1) are now charging to continue using PHP 5.6 but I get the following errors when switching to PHP 7.2 and I don't know what ...
0
votes
0answers
7 views

How to clear billing fields and set defaults in WooCommerce

I set default values for my billing fields in WooCommerce like so: add_filter('woocommerce_checkout_fields' , 'checkout_field_defaults'); function checkout_field_defaults($fields) { $fields['...
0
votes
1answer
15 views

Change default gallery images - Currently they are displaying full size imagese

Right now my page load file size is 350mb... for a website... The reason is that the gallery is loading in the full size 4000px+ images when they are actually a mere 250px in the page: Is it ...
0
votes
1answer
6 views

My jQuery Ajax form submit is still refreshing page?

I managed to get my Wordpress jQuery wired properly. Everything gets inserted to the database as expected, but for some reason, it is still refreshing the whole page? php/html (Wordpress Page ...
0
votes
0answers
13 views

How to paginate through digital downloads woocommerce PHP

So I know that Wordpress has a lot of pagination functions but they only seem to work with posts. On the users my-account page of woocommerce there is a section for "Available Downloads". I sell ...
0
votes
0answers
8 views

generate notification on name of my own plugin in istalled plugin area [on hold]

Hey i am new in developing and i want to generate notification on "deactivate option" of my own plugin on admin page can someone help me.plzzz
0
votes
0answers
14 views

Options.php file is returning to 404 error [on hold]

I am trying to change some settings using "theme options" as i am using MTS adsense theme. When i am done with my settings and after clicking on Submit button the page is redirecting to 404 page with ...
0
votes
1answer
27 views

PHP 7.2 Challenge

We have a wordpress site that required a PHP 7.2 update. The update failed and our host provider said that it was most likely a plugin that we're using. We have about 15 plugins. What would be the ...
0
votes
1answer
17 views

HTTP ERROR 500 after installing child-theme [Wordpress]

I just created and activated a child theme and now I'm getting the HTTP ERROR 500. I've deleted the child theme through FTP and still getting the error. Also tried changing wp-content/themes to wp-...
0
votes
1answer
16 views

jQuery Ajax PHP function call returning [object Object]

I want to reload page using with jQuery Ajax. I have the code below, however, it's not working and is returning error [object Object] Is this just a simple syntax problem, or is my whole logic ...
0
votes
0answers
18 views

PHP Category Filter

I am very very (very) new to all of this and have a project in seminar I'm doing. Now, the task is to add lines of code to .php file to create one more filter field to this site - https://www....
0
votes
1answer
9 views

Wordpress and Wordpress-test-lib not getting added to tmp folder

I’ve installed the wpcli and php unit testing to my imac and the wordpress and wordpress-test-lib files were added to my tmp folder as they should have. I used this to install the setup. bash bin/...
0
votes
2answers
20 views

Only allow chats from logged in visitors

I installed a plugin for a chat in a wordpress site; I want the widget to appear only for logged in users; in the php file that shows the widget I read: /* -------------------------------------------...
0
votes
0answers
12 views

Woo commerce hide category descriptions

i am currently building a site on my localhost, i have descriptions of product categories but on the category product page, it shows it twice. I have tried messing with my theme and custom css to hide ...
0
votes
0answers
8 views

htaccess questions wordpress multisite in combination with other cms

I installed a wordpress multisite on a server that already contained different subdomains and another cms installation (wolfCMS). It currently works fine by going to the root.nl/wordpress/$year/ ...
1
vote
1answer
19 views

Shortcode content output but not in correct place

I have created a shortcode that gets information from an ACF repeater field... function display_websites_shortcode() { ob_start(); // check if the repeater field has rows of data if( ...
2
votes
3answers
20 views

Loading page template into shortcode

I am attempting to load a page template into a shortcode so I can easily load the content wherever I want. I have done some research and many people have said this code has worked for them but for ...
1
vote
1answer
9 views

is_user_logged_in() not working in AJAX validation call

Update: Error was a simple typo, disregard this question. I'm using the jQuery validate plugin to validate some forms. When I try to validate something using the is_user_logged_in() function, I get ...
0
votes
0answers
10 views

Get Specific Product ID WooCommerce Comments

I am trying to place the WooCommerce comment fields but for an specific product id <?php global $withcomments; $withcomments = true; comments_template( '', true ); ?> And this custom field ...
1
vote
1answer
17 views

How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode

i trying to make excel download in front page (not admin pages) with call own wordpress plugin shortcode here is my excel download code : <?php global $wpdb; $item = get_items( $_GET['id'...
0
votes
1answer
19 views

Allow direct access to files/folders within Wordpress to replace wp-admin

Here is the scenario: I would like to design a brand new wordpress admin for my clients (using WordPress autoload as the core to interact with WordPress). I have tried slightly modifying the css or ...
0
votes
0answers
12 views

set default value to variation woocommerce dynamically

I'm trying to set the default value for a product that has 2 attributes: 1st is size and the 2nd is city. so this product has price for each city which the city will be in the cookies. so what I've ...
1
vote
3answers
26 views

How to call plugin function per site in a multisite?

My goal is to be able to call a plugin function per site and of course it has different result based on the site data. e.g. I have a plugin called: sample-plugin.php Inside it has a function ...
0
votes
0answers
14 views

Unset gateway issue with page id

I have made 2 different checkout pages, so I need to hide the bank wire option on checkout page 2 and some other payment option on the other page. Here is my code: add_filter('...
0
votes
3answers
31 views

Is there a way to get wp_editor (tinymce) content?

I want to get the wp_editor (tinymce) content then find a sentence by specific word with regex. However, have no idea how to get the content When a post is published or updated, the function will get ...
0
votes
1answer
30 views

How to align buttons properly

I am using below code on my function.php file to display two buttons. function action_after_question_content() { if (!is_single()) { echo "<a class='button-default' href='"....
0
votes
0answers
25 views

wordpress sql query pagination

for example, I want to Page the remaining comments after calling 50 comments. the page where I call the function <ul class="list-group"> <h2 class="h3">gündem <div class="...
0
votes
0answers
11 views

I want to create custome voting system in wordpress website [closed]

I created one simple website in wordpress https://goo.gl/QkxokT I want to create custome voting system in php for this website. Can anyone help me in this regard. I really appreciate it.
0
votes
2answers
22 views

Wordpress member notification

I try to implement a function to notify users about changes on the webpage. I tried to use sessions for that but it did not work very well. For example: A User can attend an event. To do that he has ...
-1
votes
0answers
26 views

WordPress | ACF | Using a variable to get_field()

I am trying to pass a variable to the function get_field($variable) from Advanced Custom Fields. This is my code: <?php // create base begining with a ' $tweet_box_size = '\'grid_box_size_'; ...
0
votes
0answers
26 views

index.php file keeps redirecting to a non-existent index.html file?

Every time I try and visit the index.php file on my website, it automatically redirects me to an index.html page. I have no redirects in .htaccess. My wordpress site is in a subdomain, but it ...
0
votes
1answer
31 views

i want add conditional for add category in wordpress

i have marketplace plugin when the seller want add product first he will choose category i want change this code to for example i have 2 main category ( A - B ) and i have ( C - D - E ) under A ...
0
votes
1answer
16 views

Remove generated category and tag class names from woocommerce product & blog listings markup

I noticed in my wordpress/woocommerce setup that every time i add a tag to a product or a blog post. It adds that tag as a class into the listed item (Product/blog) I also noticed it adds a class in ...
1
vote
2answers
13 views

Print last modified date only on posts

I'm printing the last modified date via functions.php with the following code function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = ...
-1
votes
0answers
13 views

Fetch Custom post type data with custom toxonomy

I'm trying to create custom post with custom fields in wordpress. I want to all data like title, description and custom taxonomies using custom php.
0
votes
3answers
40 views

get_the_content if it contains multiple lines it results in SyntaxError

I use get_the_content to pass to a javascript variable, and then back to another PHP function. This works great, but there is an issue when using get_the_content. If the post contains only one line (...
0
votes
2answers
29 views

Inline style to PHP

I have a piece of PHP code to grab my post title which I am putting inside of a PHP element on my page builder. $h4 = get_the_title();`echo '<h4>' . $h4 . '</h4>';` I want it to be a H1 ...
0
votes
0answers
22 views

Custom cart link - Woo [closed]

I'm creating a custom Woocommrce theme for a first time. I need help with displaying cart link in header. It looks like this https://imgur.com/AjARqhX and need to be like this https://imgur.com/...
0
votes
1answer
14 views

Return to the beginning of the results of a for loop

I am currently doing a little script (and I am rather beginner), I would like to know how to return to the result number one of a for loop after the table containing the results have been traveled? ...
0
votes
1answer
24 views

PHP question: how to combine syntax?

could someone please tell me where the mistake is in my PHP code? My PHP knowledge is extremely rudimentary although I have tried it with http://php.net/manual/de/language.operators.logical.php :-D "...
0
votes
1answer
38 views

Need help with format of nested array in MySQL

I build a plugin, that is able to run through a CSV file and parse the variables into custom fields of a custom post. In my custom post type, I build a meta box with repeatable custom fields. The ...
0
votes
1answer
19 views

Loop stopped working

I have a huge issue and I broke my had trying to find the correct solution. I have a following loop code. This loop is inside my page-product.php file: <?php $terms = get_the_terms( ...
-2
votes
0answers
13 views

Web scraping Amazon and auto product adder to WooCommerce [closed]

I want to make a script which can web scrape Amazon with searching products and auto add to WooCommerce.
0
votes
1answer
17 views

Redirect to another page after submission using wp_mail

I'm trying to redirect to user to another page after the form has been submitted using wp_mail. // Hooking up our functions to WordPress filters add_filter( 'wp_mail_from', 'wpb_sender_email' ); ...
0
votes
0answers
18 views

Encoding video without exec function

I use ffmpeg to encode videos that i upload to my website, it works fine but the problem is that it requires exec function on host enabled, my host provider says enabling this function is a security ...
0
votes
1answer
16 views

Issues Installing WP CLI

I'm trying to install wp-cli on my vps. Running the command php wp-cli.phar --info produces no output. Just to make sure php was working properly I ran a Hello World script with php test.php and ...
0
votes
1answer
11 views

Adding a widget under an 'Add to Cart' button through a PHP snippet

Despite that my PHP knowledge is very scarce I've managed to add some elements under the add-to-cart button in my installation of Woocommerce with the function: add_action( '...
0
votes
1answer
12 views

How to check if a Customizer setting is set?

I'm trying to setup a function that writes a meta tag into the header of my site. Namely, I've set up a color chooser input like this: function customizer_options($wp_customize) { $wp_customize ...
0
votes
0answers
14 views

Send Notification to all users that followed some author

I'm trying to send notifications for who followed some author when he published new post! But it always sent to only one user not to all the followers! So how can i send to all followers ids? ...
0
votes
0answers
16 views

Elementor to custom wordpress page

I have a custom page that loads wordpress header and footer via get_header() and get_footer() functions, but elementor is not loaded here. How do I load elementor css/js to custom page?