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.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 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
1answer
19 views

How to hardcode header and footer in WP?

I am playing with optimizing a site built on Divi. I'm thinking that rigidly embedding the footer and header will have a positive effect on page speed - just not quite sure how to go about it. I don't ...
0
votes
3answers
2k views

How to add style in functions.php depending on conditions?

I'm a newbie for coding, I would like to learn how to add css style conditionally in functions.php My header controlled by .header-outer class. What would it be the best way to add css depending on ...
0
votes
0answers
6 views

Redirect first comment (Thanks for comment) with show Autor name and beginning of the comment

Redirect first comment (Thanks for comment) with show Author name and beginning of the comment Sample: Open custom page with text Hi, Anderson. Thanks for your comment « Text comment... » Sorry for ...
0
votes
0answers
7 views

Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)

I mean; There are more than 7000 posts. some have private space but some do not. I want to add a custom field in bulk to those that do not contain custom fields and update their values. The following ...
0
votes
0answers
5 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
6 views

Fatal error: Uncaught Error: Call to undefined function lsvr_get_image_field() [closed]

I'm having this problem: Fatal error: Uncaught Error: Call to undefined function lsvr_get_image_field() in /home2/andrey78/camarasdn/wp-content/themes/townpress/header.php:15 Stack trace: #0 /home2/...
0
votes
2answers
57 views
+50

PHP variable = get_the_post_thumbnail_url outputting without slashes

In a custom shortcode function, I'm grabbing the featured image URL: $text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID); If I echo $text_slider_testimonial_img immediately I ...
0
votes
0answers
17 views

why cant' get string value from database

I made this code to get table name "shortlink" from database when i try to get the shortlink value, i can only get it if integer not string. php code function ...
1
vote
0answers
10 views

Connect Wordpress with SharePoint

I'm new here and I'm also new to WordPress. I'm currently trying to connect my WP site to SharePoint and I'm stuck. My approach to solve this was to search for php libraries that would help me with ...
0
votes
0answers
8 views

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

I have selection of cities and price will change according to city selection. I have customize selection of cities which is coming from table from database in front-page-features.php get_results( "...
0
votes
0answers
11 views

How to show linkedin from user info wordpress?

i need your help guys i want to show this linkedin information from my user management. But i dont know how to show it cause i dont know why this form is there, i mean so many form url profile there. ...
0
votes
0answers
14 views

How to display single product on shop page in WooCommerce

I want to display single product page on shop page using specific product id. I need all HTML design of single product page setup by current active Theme. I want to display single product into pop-up ...
1
vote
1answer
1k views

Dynamic content based on a URL parameter

So, I'm doing some wordpress development studies and classes, and now I got an project to work on, and need to get the following task done: I'm doing a telecom website. The site has a page called "Buy"...
0
votes
1answer
953 views

How to override html codes in wordpress?

<article id="post-<?php the_ID(); ?>" <?php post_class( array('list-article', 'clearfix') ); ?>> <div class="list-article-thumb"> <a href="<?php echo esc_url( ...
0
votes
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
0answers
9 views

How to update wp-config file in Docker

I am trying to change our blogs from Wordpress to inside a docker container, so that we can move around it easily. I wrote a docker-compose file for the purpose and it ran smoothly the first time. But ...
0
votes
0answers
11 views

I need help with removing the a href file from all of the item on the content-product.php

I am needing to remove the product link as pictured below from the I'm not sure how to do it. can some one please help me, any method such as PHP, html or other can be used. Thanks again Kind Regards
0
votes
0answers
10 views

How to disable e-mail notification new comments for some categories

How to disable e-mail notification new comments for some categories Sorry for my English
0
votes
1answer
81 views

Customize the “Available for back order” text for specific variation

In Woocommerce, on the product page, i want to customize the "Available for back order" text for specific variations (size L and XL). So when a customer selects size L or XL, the "Available for back ...
0
votes
0answers
58 views

how to echo a background image in a custom post type

I've setup a loop for custom post type // The Query $the_query = new WP_Query( 'post_type=support_medewerkers&posts_per_page=1' ); // The Loop if ( $the_query->have_posts() ) { while ( $...
0
votes
0answers
12 views

Source link plugin - show just anchor / link

I implemented a small source link plugin on my Wordpress website via the following codes. Single.php: <?php global $post, $pages, $page; $total = count( $pages ); // Link ...
1
vote
1answer
2k views

Seach custom post type posts only by meta fields?

is it possibile to search custom post type product by _sku or other custom meta field with input text field? I don't want to use plugin, just need custom WP function. I have found this solution for ...
0
votes
1answer
14 views

I want to remove the register/login Wordpress top bar from my website

enter image description here]1, This screenshot above shows the functions.php code snippet I tried to use to remove Wordpress register/login top bar from my website but so far it haven’t worked. I ...
0
votes
0answers
6 views

Change billing fullname with a custom field in Woocommerce emails

I using Checkout Field Editor for WooCommerce to make 25 custom field. I have problem billing_fullname not show in customer details but show in billing address. So i have thinking about a solution ...
0
votes
1answer
759 views

SQL Query Search page

I am trying to create a Wordpress webpage that has an input text box and a button. what I want to do is take the input text from the text box and use it as a parameter to search a table I put into the ...
0
votes
0answers
7 views

Missing post when i switch language from default english to japan

I am using the Polylang plugin. The default language is english and it displays the news section, but when I switch to JP (japanese) the news section is missing. $news = new WP_Query('category_name=...
0
votes
0answers
93 views
+100

PDF file randomly breaks upon upload

The issue randomly started happening. When I upload a PDF file via the media library, it sometimes 'adds' random lines and graphics to the PDF file(or solid brown color), but sometimes it is okay. WP ...
0
votes
0answers
10 views

Unable to update wordpress due to database error unknown column

I get this error in my wordpress error log [05-Mar-2021 04:10:10 UTC]WordPress database error Unknown column 'tickbox_auto' in 'where clause' for query SELECT * FROM wpdx_payment_discount WHERE status ...
1
vote
1answer
121 views

Force SSL using FORCE_SSL_ADMIN

I followed this advice from the official docs to force SSL: define('FORCE_SSL_ADMIN', true); if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on'; Wordpress runs ...
0
votes
0answers
27 views

Error when adding excerpt to the content through functions.php

I am trying to add the excerpt from a specific post to the content. function add_2_the_content( $content ) { if (is_front_page()){ $custom_content = get_the_excerpt('some_id_number'); } $...
0
votes
2answers
20 views

Parse error: syntax error, unexpected '}' surrounding a while

I'm just having trouble figuring out why I'm getting an error at the "}" after the "$attachment_image" line, just before "". I'm probably just too tired to see it. <?...
3
votes
0answers
210 views

Gutenberg Blocks doesn't render correctly when using do_blocks

I'm trying to render a post_content with blocks using the do_blocks function, that takes a gutenberg content, parses every block, and returns an HTML string. The problem is that some blocks aren't ...
0
votes
0answers
15 views

Add width and height attribute to an img tag

I am using Hood Theme and I have a logo on the top left on my navigation. I have set this logo to 150x50 which works fine. But the tag doesn't have the width and height attribute. Google PageSpeed ...
0
votes
0answers
7 views

How to create post comparison in wordpress

I am creating a feature in the child theme which is vehicles(car) comparison. the checkbox will add the vehicles(car) in the compare list from the car listing page. and compare page will give the ...
0
votes
0answers
13 views

Mobile detect directive only works after first refresh [closed]

I am trying to detect mobile devices and send them to a different directory on my server. The desktop version of the website is a WordPress website; the mobile version is HTML. At the moment, the ...
0
votes
1answer
836 views

How can i get the same ajax result using WP REST API instead of admin-ajax?

I have been told that admin-ajax is outdated now and it's better to use REST API instead but I was wondering how can I get the same result of this code which generates a button with a link based on ...
-1
votes
0answers
12 views

I need to know how to add a php code into our company's website [closed]

I have a data receiving from HART Devices and need to store that data in php file. I need to store that HART data in our company's website. Whenever I type our company's website as given below, I need ...
0
votes
3answers
1k views

How to pass username into form that sends data to database

I am trying to pass username to database through form: [insert_php] $current_user= wp_get_current_user(); $id= $current_user->user_login; [/insert_php] <input type="hidden" name="id" value="[...
0
votes
0answers
9 views

show category list with images of associated posts

any way to display a list of categories with a single image of any post associated with that category? i have this code: $categories = get_categories( array( 'orderby' => 'name', ...
0
votes
0answers
14 views

How to Generate Random index page/content like the website “What The Fuck Should I Make For Dinner?” [closed]

I want to create a website similar to "What The Fuck Should I Make For Dinner?" I don't want to just have a button that takes the user to a random page changing the permalink each time. The ...
0
votes
1answer
1k views

Woocommerce Related Product by 2 taxonomy

I need to change related product by taxonomy and if taxonomy didnt have enough product, display rest of it from other taxonomy. I have 2 taxonomy; product_tag and product_cat. Sometimes products in ...
0
votes
0answers
8 views

WC Update (just save) all Products at once (php?)

i need to save every single product again. but all at once since i have 1000 products. reason being is that im using the WC api to import WPML Translations and they need to be saved since WPML doesnt ...
0
votes
1answer
1k views

Open image gallery on link click

I have a very simple wordpress problem, but I'm still struggling to figure out the solution. I have an anchor tag, and I want it to open an image gallery in a lightbox (as the default behavior when ...
0
votes
2answers
28 views

Display values of current POST request on page

I would like to get some value that was included in the http request header and display it on my webpage, i.e: I have a webpage, say: 'mywebsite.com' I have a POST request to 'mywebsite.com' with a ...
0
votes
1answer
722 views

Sort by multiple options in custom field

With use of the Advanced Custom Fields plugin I created a select dropdown which contains 6 membership types. All of my 'listings' using this custom field are assigned one of the 6. I'd like to ...
0
votes
1answer
1k 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
24 views

Unwanted code being automatically added to the functions.php and makes the site very slow [closed]

I have a website that is built by WordPress and it uses the Avada theme. It's a long time there has been a bizarre problem which occurs every few days. When it occurs the site pages can't be loaded or ...
1
vote
0answers
14 views

Automatically adding new post categories to menu

Disclaimer: I am not 100% fluent in php. If I am doing something wrong in asking this here, please let me know. Many thanks! A site that I am working on is set up with several custom post types: City, ...
0
votes
0answers
15 views

Show Content of shortcode out of div and site structure

With this function, I generate a series of shortcodes, some of which are variable. The problem is that when this shortcode is placed inside the site, the content of the shortcode is displayed, but the ...

1
2 3 4 5
190