Stack Exchange Network

Stack Exchange network consists of 174 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]

The server-side programming language that the WordPress core, plugins and themes are written in.

1
vote
1answer
19 views

IMG src weird behaviour inside a single post loop

I was trying to sort out the final look the featured image of a single post, so for the purpose wanted to add a class to the img tag. However on the way, I run into some weird behaviour while trying ...
0
votes
0answers
26 views

How do I add a section to a wordpress home template

I could really use some help with this one... I managed to add a lead section to my wp homepage (home.php): <?php if (is_home() && $paged < 5 && $paged > 2 ) { ...
1
vote
1answer
26 views

Shortcode created to check language not works

i need to create a shortcode to display a different Div depending on WP current language only when users are logout. The shortcode is this one: function coupon_box() { $user = is_user_logged_in() ; ...
0
votes
3answers
31 views

Get user custom field value on function.php

I created a function in function.php which send an email with user information at registration. I succeed to get the ID but I can't get custom fields... I only can get these ones : - ID - ...
0
votes
0answers
10 views

How to style Image and Gallery Output for AMP?

So, I am trying to create a custom AMP template for my website without a plugin. Here's where the problem is. I am using a single-amp.php to redirect /amp posts to the AMP template. I have then used a ...
0
votes
1answer
19 views

get_posts works in the page template but not in a shortcode

I am trying to write a shortcode, which includes 'get_posts' in order to get the blog posts data and then display the 3 most recent on the page. This code works within the template. However, when I ...
0
votes
2answers
46 views

How can I resolve the php notice “Constant EMPTY_TRASH_DAYS already defined”

With define('WP_DEBUG', true); in wp-config.php, I get the following notice: Constant EMPTY_TRASH_DAYS already defined in /wp-config.php on line 83 I have checked this file, and this constant is ...
0
votes
0answers
16 views

Filter page results for custom post type - custom field

I use gravity forms to allow users to submit their own blog posts and I have a custom field in that for country. I am wondering how this would look like to make this happen where a user can have a ...
0
votes
0answers
10 views

Meta Box clears saved field content

I'm new in WP developing. I added metabox field to page, all works fine, but last one, which is similar with others, when I press save page button it clears all fields, even fields which were saved ...
0
votes
0answers
21 views

Query multiple meta_keys with the same value

I would like to search multiple fields with the same value. For example: can "accounting" be found in the the following fields Services1, Services2, Services3, Services 4. And the url passing the ...
0
votes
1answer
32 views

Unexpected behavior when trying to manually install Wordpress on macOS Sierra

Server Configuration macOS Sierra 10.12.6 Server App v5.3.1 (Websites Service is ON and serving other sites) mySQL v8.0.12 (Verified up and running) PHP v7.2.10 (Verified through phpinfo()) Wordpress ...
0
votes
1answer
20 views

Disable if there are no children - Woocommerce

I have some code that displays the children categories on the screen but some parent categories do not have children if that is the case I don't want the section to be shown. does anybody know a way ...
0
votes
1answer
18 views

Change Search display for Custom Post Type

I want the search to not search for custom post type "mitgliederbereich" when on other pages, and when you are on the "mitgliederbereich" page, that only "mitgliederbereich" posts should appear in ...
0
votes
0answers
13 views

How to randomized order of widgets inside the page content area of the homepage?

I have a wp plugin installed called siteorigin page builder, which has a layout builder where i can add a bunch of widgets inside the content area of my page. How can I make it that every time my ...
0
votes
1answer
36 views

Remove duplicates - array_unique()

I am trying to make a simple list of names that link to profile information. Some of the people in the list have multiple addresses and therefore appear multiple times in the list (as their addresses ...
0
votes
1answer
32 views

proc_open() fires twice

A WordPress post is supposed to process sample data (uploaded as PDF files) and displays the data (after some manipulations and reformatting) on the same post just below. ... <form action="" ...
0
votes
0answers
22 views

Conditionally change a hyperlink url based on user role

I am looking for a way to change the destination URL of a hyperlink based on the logged in user's user role. I will have 3 custom user roles: Persona 1 Persona 2 Persona 3 The website will be a ...
0
votes
1answer
20 views

custom post type column countdown

i have registered custom post type and i have created custom columns for it one of those columns is count down it's functionality to cut the NowTime from the custom meta date and time i have set ...
0
votes
0answers
23 views

ajaxurl usage for a custom function

I am creating a custom form in one of my paste and its getting submitted using AJAX post method. Here is my code: HTML for button : <button onclick="result()" type="button" name="result_submit" ...
0
votes
1answer
22 views

How do I create a secondary version of the_content

I am trying to create a secondary/alternate version of the_content with some changes. This is the code I found to start with:- function new_content($content) { $content = str_replace('<img','<...
0
votes
0answers
11 views

update and save plugin settings once daily

How can i auto click 'save settings' button in my plugin automatically once daily this is the rendering of the button in my settings page: echo '<form id="' . $this->_settings_key . '_form" ...
1
vote
1answer
40 views

Different output from WP-CLI in bash vs PHP exec()

I installed this package on WP-CLI. When I run wp login create in bash it works fine, but when I run exec("wp login create") in PHP script WP-CLI return this error: Error: 'login' is not a ...
0
votes
3answers
91 views

Ajax call to php function doesn't work PHP code

I have a form like this: <form method="post" action="" id="BookingForm"> <label for="email">Email</label> <input type="text" name="email" id="emailId" value="" /> &...
0
votes
2answers
64 views

Woocommerce remove menu item on myaccount dashboard

I'm doing a redesign of the woocommerce dashboard. I had copy the dashboard.php from woocommerce folder to my theme folder. So now I want to get rid of the side menu from dashboard only(Remain on ...
0
votes
0answers
45 views

Custom endpoint without loading entire Wordpress

With only WooCommerce installed the Wordpress rest api loading time is above 1.5s, this is unpractical, so i'm trying to create a custom endpoint and define SHORTINIT to true to load the minimum ...
0
votes
2answers
20 views

Styling a specific post after hovering over it

Background My website is organised in a grid layout of four columns of divs. Each div is a container for a post and is a square of 200 x 200px. The title is a header at the bottom of the div and ...
0
votes
1answer
37 views

How can i style “echo apply_filters”

With WordPress I have years of experience but with PHP I do not have much experience. I want the available product colors on the shop page and that's working! :) But i want a text before the ...
0
votes
0answers
54 views

Error http 500 “admin-ajax.php”

I'm having the error below displayed in the Chrome console every time I try to run a particular plugin. His name is YITH Watermark. The 500 error occurs exactly when I click the button to generate the ...
0
votes
0answers
25 views

Incorrect FTP authentication is blocking a plugin install and setting FS_METHOD to 'direct' in wp-config doesn't help

I'm trying to install the plugin "Form Maker by WD" into my WordPress site. Whether trying to install directly or through downloading and then uploading it, it throws an "incorrect ftp username/...
0
votes
2answers
24 views

ACF: Echo page title when checkbox is checked

How can I show the title when a checkbox is checked. I use Advanced custom fields my field name is nav This is what i currently have. <?php if(get_field('nav')) { ?> <li> <a href=...
0
votes
1answer
23 views

deactivating an active plugin using if page

Good day! just wondering if you can help me out? I was trying to create a code for functions.php if the user currently lands on a specific page, thus the plugin will turn deactivated, but if the user ...
0
votes
2answers
30 views

How to echo every parent page title?

I have like 5 parent pages and would like to echo all their title's on the front page.php. Maybe with get_the_id(); but don't know how.
0
votes
0answers
7 views

Thank you page redirect to same after successful submission and the form is overlapped with thank you display in complete width of the form present

Anyone please help <script> function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField....
0
votes
0answers
13 views

Gallery only displaying the thumbnail picture

When we click to view a full gallery it just shows the full-screen version of the thumbnail. This problem began after we updated our plugins, but I tried deactivating them one by one and the only one ...
0
votes
1answer
22 views

Hook into all password resets in Wordpress and get password before hashing?

I'm syncing my Wordpress authentication system with an secondary/external authentication system and my site has at least two ways of resetting the password, including: Password reset email User ...
0
votes
2answers
22 views

Show parent category and subcategory once in while loop

I have tried several things but unfortunately do not manage to do it in a good way. I use a while loop to pick up dealers (custom post type) from different countries and provinces. In this loop of ...
0
votes
1answer
31 views

How can I add tinymce editor in Wordpress with jQuery?

I need to add a tinymce editor with a jQuery function. I know that tinymce is a js based editor so there need to be a way to do something like this: <div class="container"> <div class"...
0
votes
0answers
55 views

Update shipping rate cost based on Postcode dropdown choice

So this one is a mind bogle.... I hope someone has the time for this one. Similar questions have been asked, but none have the solution to this, so please :-) Im using custom scripts to change ...
1
vote
1answer
24 views

Use wp_get_recent_posts with search term

I have a function that uses wp_get_recent_posts() I need to use this same function on my search page but am having problems adding the search parameter to the $args array. Does anyone know if this ...
0
votes
1answer
24 views

How can I add a button the the WooCommerce MyAccount page?

I'm trying to add a button at the end of my WooCommerce MyAccount navigation: I need this after "Konto-Details". I'll name the button "Konto löschen". So far so good. This is what I've tried: ...
0
votes
0answers
18 views

Need to insert custom shortcode to replace theme search

I'm using ajax search pro and the replace search feature (which replaces current search with new ajax isnt working.) I'm trying to replace it but I'm not 100% where to put the short code. Theres a ...
0
votes
1answer
32 views

List events by month

I am working on a WordPress site consisting of a custom post type called "events". Each "event" consists of a custom field called "event date". I'd like to organize all the "events" by months based on ...
0
votes
0answers
17 views

Widget PHP code isn't working

So I have a custom post type, and a php code widget that is connect to said post type and updates every time there is a new post in that type, but it's supposed to redirect when the display on the ...
0
votes
1answer
13 views

How can I get all values from my array in a loop in php? [closed]

I've following array: Array ( [0] => Array ( [0] => 585 [1] => 596 ) ) Now I want to print all values (585 & 595 .....) row for row in a ...
0
votes
0answers
16 views

Hot to edit WooCOmmerce dashboard?

I'm trying to edit the WooCommerce MyAccount dashboard. When you take a look at my function you can see that I first tried to remove the whole content because I want to set my own one: add_action('...
0
votes
0answers
24 views

How can I get date range of Events even if not exists?

I am building a Tribe Event Calendar custom Carousel query (wP_Query) in Wordpress using a custom query. I have the events query working great, but I want to display even the empty dates that have no ...
0
votes
1answer
20 views

Generating rel=“prev” and rel=“next” using filters

In wp-includes\link-template.php the function which defines the pagination is: /** * Retrieves the previous posts page link. * * @since 2.7.0 * * @global int $paged * * @param string $label ...
2
votes
1answer
56 views

Updating WooCommerce variable product stock issue

Soo.. I've created CRON script, that each 1 minute retrieves an actual stock systems data, converts it for Wordpress/Woocommerce database table and updates stock. On database side everything looks ...
0
votes
0answers
31 views

Problem with Mobile navigation menu with wp_nav_menu() function in WordPress

Here is the problem. I'm creating a theme in WordPress and I have trouble with dinamic navigation menu on Mobile devices. Here is the code which I use: <nav id="primary-menu" class="navbar navbar-...
0
votes
0answers
17 views

How to create a gallery using WP CLI?

I am hoping someone has some insight into how to create a gallery using WP CLI. Or at the very least get the IDs for the images imported using "wp media import". I've tried using --porcelain but it ...