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
0answers
7 views

Add Product Permalink Before Order Item Meta

I am using the following code to add product permalink in woocommerce admin order page- function fpd_custom_order_item_values($_product) { $url = $_product->get_permalink(); echo '<p&...
0
votes
1answer
28 views

How to edit a plugin's front-end in wordpress?

I am a newbie in the wordpress development scenario, I have installed a marketplace plugin (WCFM) for my wordpress based site. Now, I saw the plugin editor which allows us to edit the plugin's php ...
0
votes
1answer
12 views

Change Login or Logout text based on status

I'm trying to display text in a button in the header that says "LOG IN" or "LOG OUT" depending on the visitor's status. The button calls a slider action, so I just need to change the text displayed on ...
0
votes
0answers
9 views

How can display image on woocommerce product page?

i already have code written but didn't know how can link my image with this function listify_cover( $class, $args = array() ) { $defaults = apply_filters( 'listify_cover_defaults', array( ...
2
votes
1answer
14 views

How to Add a Link to the Drop-Down User Menu in the Admin Bar?

I need to add a link to the drop-down user menu in the admin bar. Is there a hook or function for this?
0
votes
1answer
15 views

Add Product Permalink in woocommerce admin order page

I am trying to add the permalink of product on woocommerce admin order page with this code: function fpd_custom_order_item_values($_product) { $url = $_product->permalink; echo '<p>'.$url....
0
votes
0answers
18 views

How to create a A-Z glossary

I am working on a plugin that lists all the available sites on our multisite, I have it working but was trying to find a way to navigate by letters or just create an A-Z glossary. <?php function ...
1
vote
2answers
41 views

Get list of shortcodes from content

I need a list of every shortcode inside the content. Is there any way to list them? This is what I need: $str = '[term value="Value" id="600"][term value="Term" id="609"]'; So every shortcode ...
0
votes
1answer
30 views

Proper use of Output Buffer for a whole php clas

For my ajax popup login i want to use Output Buffer for a whole oop php class. I just want to start buffering from the start of class and end it when the class is finished. class Wp_Ajax_Popup_Login {...
0
votes
1answer
17 views

Show subcategory name selected in specific category woocoommerce

Hi basically I have categori ID number (134) that has 2 child of that (red and blue). I selected the blue one. I want to display only the selected one (blue). But at the moment the show all ...
0
votes
0answers
20 views

How can I update all product data in woocommerce based on the attribute selected or variation selected?

I want to update the woocommerce product page based on attribute selected. Normally it just shows the parent product info. So i am looking to update the data such as such as title, description, ...
0
votes
0answers
22 views

Why my Ajax events are no longer detected after dynamic change of shortcode content

I have two input select (dropdown) in the content of my shortcode. The first is created when initializing the shortcode content, while the second is created when the user chooses the value of the ...
0
votes
0answers
14 views

Posts Per Page with a button to add more Posts

I have $recent_posts array with a 'posts_per_page' that look like thah: <?php $num_per_page = 3; $recent_posts = wp_get_recent_posts(array( 'posts_per_page' => $num_per_page, '...
0
votes
0answers
10 views

Video Gallery similar to Google Image search

Has anyone discovered a good, reliable plugin that has the same mechanics as Google Image Search — i.e.: the thumbnail expands a panel below with info and media? My client is trying to create a page ...
0
votes
0answers
17 views

WP Migrate DB Pro plugin cannot transfer Media files to remote server

I'm using Delicious Brain's WP Migrate DB Pro plugin to migrate database tables and to transfer Media files (add-on) from my local virtual machine to my remote server (provided by GoDaddy) This ...
0
votes
0answers
25 views

The first load of the site is VERY SLOW (not related to cache)

Before I continue, I just want to mention that I search everywhere for solution and tried many many configurations and couldn't resolve the issue. I installed wordpress (on 3 different servers to ...
0
votes
0answers
16 views

How do I remove all values by brand?

How do I remove all values by brand? $allpostids = 'All Postids'; $allmetakeys = 'All Metakeys With Dots And Numbers'; $allnumberswithcomma = 'All numbers with comma' ' Markerfordeletion'; ...
0
votes
1answer
26 views

Best way to use a large array in function

I need to define an array which has more than 15000 values in the wordpress functions file: $validpin = array(110019,111222,112233); I have written only 3 values to explain but the actual array ...
0
votes
1answer
23 views

Add Shortcode to ::before class

I want to add a button (that will open an INFO popup screen with info about a certain option in a woocommerce variable product), all that can be easily created with a plugin that converts the whole ...
0
votes
0answers
15 views

How do I create a column in the ‘ Post Meta ‘ in PHP or plugin?

How do I create a column in the ‘ Post Meta ‘ in PHP or plugin? function new_column_postmeta() { CREATE TABLE IF NOT EXISTS <code>wp_postmeta</code> ( <code>meta_id</code> ...
0
votes
0answers
19 views

On only some bbPress forums I would like to allow new topics but not replies

postid-316 .bbp-topic-form { display:none;} this works .bbp-reply-form { display:none;} this works postid-316 .bbp-reply-form { display:none;} this does not work I have spent hours on google ...
0
votes
0answers
12 views

Have custom post type posts show under regular posts in sitemap (Yoast)

I have a custom post type called FAQs, and I'm using Yoast SEO to generate a sitemap. The sitemap gets generated like it should, but it creates a completely separate sitemap for the FAQ post type, so ...
0
votes
1answer
19 views

Do not show child pages within a file page

I have a CPT created, in my CPT file page the father pages and daughter pages are shown. Books of science Book 1 Book 2 Books of science fiction Book 1 Book 2 In my case I don't want it to ...
-1
votes
0answers
27 views

how to match preg_match 2 word are same page we want second word not 1

let see my source code <?php class MEmbed_xvideos { public $url; public $user_id; public $category; public $status; public $video; public $errors = array(); public $...
0
votes
1answer
14 views

Wordpress: Redirect Main Site to Subsite in Multisite Where user is NOT logged in

I have found this solution ( https://wordpress.stackexchange.com/questions/66115/redirect-main-site-to-subsite-in-multisite-wordpress ) regarding redirecting a mainsite to a subsite in wordpress. But!...
0
votes
0answers
18 views

How To Display PHP Loop Data Using jQuery or PHP?

i have this php file i want to show same input field in both place, actually what i want, i want an input box after question, sample field $clue.="<input type='text' id='field_2'>"; i want to ...
0
votes
0answers
3 views

Fatal error: Call to a member function get() on null in C:\appserv\www\Cocolani\php\req\register.php on line 4 [migrated]

I'm from Egypt so I apologize for my bad language I'm still a beginner programmer , so I hope you give the solution step by step. I'm trying to make a private server for a flash game and i have a ...
0
votes
1answer
34 views

get_template_part() not working with Advanced Custom Fields plugin

I work on the WordPress project I created testimonials in a special file called testimonials.php and I called the file on the page about us by get_template_part and it works fine but when I called (...
0
votes
1answer
23 views

Add function to head “no product found”

I build my proper shop with ecommerce, and I'm beginner in development, I know correctly the CSS/HTML but JS he's not my tea cup... Actually, I want to display some products randomly in my "...
0
votes
0answers
21 views

Accessing an external database

I manage a web site for a charity. We are in the process of moving from WebPlus (no longer supported by Serif) to WordPress. Once the move is complete I would like to introduce a database of members,...
0
votes
0answers
10 views

Custom WPBakery elements not displaying in WP admin

I'm creating custom elements for WPBakery. I have a folder called vc-elements which contains two files: hero.php text-image.php On the WordPress admin side, I want both elements to be visible. To ...
1
vote
1answer
26 views

get current product name in functions.php

i create a button in a current product page after woocommerce_single_product_summary i would to get information about the current product ( for example name and price) and through the button send an ...
0
votes
3answers
31 views

add_action in wp_head accessible from class

Given this code: class test_class { function greeting() { echo 'Howdy! Test is successful!'; } function greeting_head() { //Close PHP tags ?> <?php ...
1
vote
0answers
12 views

Wordpress every page is 404 not found including admin resources

Haven't changed anything on my wordpress in about a year. Suddenly every page is 404 not found, including the admin dashboard. Any help much appreciated.
0
votes
2answers
12 views

List all ACF field values across every post on one page

I used an ACF repeater field for data sheets/instruction manual download links of products in woocommerce. There's 50 products and each has 1 to 4 download links on their product page. I've been ...
0
votes
0answers
15 views

Custom theme index layout not displayed correctly

I'm making a custom theme that I'm planning to sell. I'm reading some guides about themes creation, I have already experience with wordpress but this time I want to make a nice theme. I'm facing a ...
0
votes
2answers
32 views

Adding regular php file to site

How do I create a page(in wordpress theme folder) so that it can be accessed on my site as examplepage.com/somepost.php? I can see it as examplepage.com/wp-content/themes/mytheme/somepost.php but is ...
0
votes
0answers
13 views

Automatically associate the product image with the SKU

I manage a website that references more than 40,000 products. We used WP ALL IMPORT to import the products (more than 48h of import), and we had problems with images that are not imported while they ...
0
votes
1answer
48 views

Cannot fetch posts with certain 'product_cat'. WP_Query is empty

I want to set attributes for woocommerce products in certain product category. The query, however, doesn't seem to work. I've placed the following code into functions.php of my child-theme. Tried ...
0
votes
1answer
8 views

Taxonomy doesn't follow slug permalink structure

I started with a fresh template and added a Post Type according to specification at GenerateWP. I then added a taxonomy to the custom post type, also according to the above-referenced website: // ...
0
votes
1answer
31 views

Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?

Writing a little plugin my code is like this: add_action( 'edit_user_profile_update', 'sulock_save_profile_fields' ); function sulock_save_profile_fields( $user_being_edited_id ) { if(...
0
votes
0answers
10 views

How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?

Category and Taxonomy admin pages are different from posts pages in that the items are listed and the form is also present on the same page. I would like to separate them for custom taxonomies so ...
0
votes
2answers
28 views

Warning: count(): syntax problem of the count () function

I'm trying to repair a function that was working properly before going to php 7.2. The error comes from the count () function but I do not know how to rewrite it. Can you help me ? Here is the error ...
0
votes
1answer
51 views

Change the week start day from Monday to Saturday

To display the number of weekday I use the following: echo "Today's date is: " . date("Y/m/d") . "<br>"; echo "The weekday is: " . date("l") . "<br>"; echo "The number of the weekday is: "...
1
vote
1answer
74 views

class click counter save number

When the user clicks class count the counter should work: <div class="pop-btn" class="counter"><a href="https://www.example.com">Know More</a></div> <div class="count">&...
0
votes
1answer
27 views

Fatal error: Uncaught Error: Call to undefined function wp_nav_menu()

I am getting this error which Fatal error: Uncaught Error: Call to undefined function wp_nav_menu() in /home/stageidg/public_html/idg/wp-content/themes/idg-child/secondmenu.php:2 Stack trace:...
1
vote
0answers
15 views

How to make a XML/PHP file returning custom field data from page

I want to make a make a Ajax search bar that uses an XML file that will be made from the acf of the users profile page that gets return from the PHP template. How do I go about creating an XML file ...
0
votes
0answers
13 views

Closing Comments conditionally in comments.php

I have a website running shapely as my theme, and I am trying to allow only logged in members to see comments on a post, and restrict anyone but administrators from commenting. I would like comments ...
0
votes
0answers
14 views

Wordpress generates weird permalinks

I have a problem with weird permalinks generated by wordpress https://example.com/page/19/ https://example.com/page/19/?cat=-1 https://example.com/?cat=-1 How I can fix it and disable generating ...
0
votes
1answer
25 views

Reload page with a different shortcode when a user selects from a dropdown

I'm using WP Job Manager, and the page which lists all available jobs is delivered using a shortcode which can be customized. so [jobs per_page="10"] is outputed in the frontend as: <div class="...