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
4 views

How do I get my Javascript scripts working?

I am reading through the developer site for Wordpress and am just at the beginning of my learning of it. I have gotten my CSS to work via the wp_enqueue_style() but my javascript won't work via the ...
0
votes
0answers
8 views

Migrate a normal website to Wordpress

recently I decided that I want to move my website with custom CMS to WordPress. I was wondering if there is an automation tool to help me with that process. I have already made the design and I just ...
-1
votes
0answers
19 views

Using functions.php to hide the `From Our Blog` in WordPress menu page

I'd like to remove the from our blog on the WordPress menu page using php. Is there any way of doing it in functions.php? Tried. add_action( 'wp_dashboard_setup', 'bt_remove_dashboard_widgets' ); /*...
9
votes
2answers
451 views

Inconsistent temporary 404s on whole install | PHP error with post-template.php

I'm deeply confused by this one: I have a WordPress install on a Media Temple GS [one of many which work fine and are configured almost exactly the same] which is occasionally giving me 404s sitewide. ...
0
votes
1answer
33 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
1answer
925 views

Automatically create a loop for post ID

I am having trouble generating a loop for my post. The JS calls the slide_ID which then needs to display each slide-ID in numeric order for it to work. Example for slide-1 to scroll to its next slide ...
0
votes
1answer
540 views

Wordpress on AWS with ELB

The plan is to install wordpress on AWS with ELB. So far I have two instances of Ubuntu 16.04 each with PHP7 and both connected to RDS (MariaDB). The PHP Session is shared between the ec2 instances ...
0
votes
0answers
10 views

Show the subcategory name based on current product

Hi I can display subcategory name in current product page (single product page) but it showed all the subcategory name. I just want to show subcategory name based on the product selected. I have one ...
0
votes
1answer
16 views

Wordpress AJAX PHP(html) file that is within Wordpress Loop

I have a Wordpress AJAX call that is working in as much as it is able to get raw data from a PHP file. The AJAX is using the admin-ajax.php file. However, the PHP file I need to get is within the loop ...
0
votes
0answers
8 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
31 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
23 views

Change upload URL by mime type

I'm working on a site that has several hundred pdf files uploaded over the course of a few months. All uploads are organised in the uploads directory by year/month. The client has just decided they ...
0
votes
1answer
15 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 ...
3
votes
1answer
775 views

How to Join two tables from separate databases within Wordpress

Using wpdb to connect to a separate database I have connected to my other database with this code $mydb = new wpdb('username','password','database','localhost'); Now I need to do a Join of a table ...
0
votes
0answers
11 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
0answers
22 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 ...
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....
1
vote
2answers
44 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
733 views

how can I disallow special characters, space, capital letter, dot in user name on registration?

i am running membership site. any one can registered on my site. i want to disallow special characters(ie:!@#$%^&*), space, capital letter, dot(.) in user name on registration. i don't have any ...
0
votes
1answer
101 views

Repeater field empty taxonomy and saved choices

I'm in trouble right now and I need you to help on a little problem that I have. For one of my clients I need to use ACF repeater field and populate it with empty categories from a custom taxonomy ...
0
votes
0answers
23 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, ...
6
votes
1answer
543 views

Pass media upload value to input field

I have created a meta-box that provides a upload function via the default media uploader from WordPress. This works fine as long as I have one upload option. But guess what? I want another one. If I ...
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
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
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
1answer
616 views

WP_Query with AJAX returning empty array

After extensive reading about this I've hit a wall with troubleshooting, so I figured I'd ask on here. I'm building out an AJAX call that will run a WP_Query and return a series of posts that have a ...
2
votes
2answers
42 views

Missing Author Information

I am having trouble displaying the author name and avatar on my single.php page. The posts load fine and all the correct information is available. However the avatar and name is no where to be found. ...
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
18 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
2answers
547 views

Get first comment link on the post itself

I have this function and a link to a post: <?php foreach ($results as $id) { $post = &get_post( $id->ID ); setup_postdata($post); <li><a <?php href="<?php ...
0
votes
1answer
607 views

Processing forms with php to wordpress database

I'm simply trying to process data from an html form into my wordpress database through php. I've tried multiple times to get the data inserted but have had no luck. The setup is as follows: Database ...
0
votes
1answer
658 views

Get all posts including sticky ones with get_posts(),setup_postdata(), and foreach loop?

I am using this code to fetch my posts: <?php if ( get_query_var( 'paged' ) ) { $paged = absint( get_query_var( 'paged' ) ); } elseif ( get_query_var( 'page' ) )...
19
votes
5answers
22k views

the_date() not working

I am using wordpress 3.2 and I did a query post like this: <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?> Then I try to echo out the date of this post I queried like ...
0
votes
1answer
586 views

Create onClick Event to Re-load a Widget

Hey guys I have a "add to favourites" button which, when clicked on, adds a post to a list that a user can view on the page /my-enquiry-list/. I have managed to create a widget that displays the ...
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
26 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 ...
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
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
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
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
526 views

Add specific content after specific text in every post

Suppose I want to add some imagess in my all posts Eg. I want add this : <img src="ad.png" > after this text That's all every post & that image should be different in different category....
0
votes
1answer
563 views

Display PHP within HTML values

What is the correct way to display a value in a link using php? The (Advanced Custom Fields) php works correctly outside of the html. Book on Expedia.com <a class="alignright" href="<?php ...
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 ...
0
votes
1answer
1k views

difference between sanitize_email ,FILTER_VALIDATE_EMAIL and input email type in html5

what is the difference between using: HTML 5 <input type="mail"> (it validate user email input without any JavaScript or any other code. 2.PHP filter_var($email, FILTER_SANITIZE_EMAIL); ...
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
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
2answers
638 views

Dynamically Create Posts Via XML File

I'm new to wordpress/php and I'm trying to create new posts dynamically through a xml file. The xml I'm working with is this one. The file get updated periodically during the day in a FILO fashion (...