All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
410 views

Custom excerpt length filter doesn't work

So I'm trying to change the standard post excerpt length. Every single blog post on the web tells me to do it with a filter like this: add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); ...
3
votes
3answers
13k views

how to use wc_create_order with subscription product

I want to create a new order programatically. This code works well with simple product, $product = get_product($product_id); $order = wc_create_order(); $order->add_product( $product ,...
0
votes
0answers
2 views

Facet WP template to display same post multiple times

I have an "event" post type that has multiple event dates - i.e., recurring events. Those events are displayed with Facet WP (which uses a normal WP_Query call to generate the result list) Here's how ...
0
votes
0answers
4 views

W3 Total Cache Error: some files appear to be missing or out of place. Please re-install plugin or remove

I used to have the "This site is experiencing technical difficulties." error message and went to CPanel to change the wp-config file and change the WP_Debug false to true but it's showing more error. ...
0
votes
0answers
2 views

Dropdown Menu Still Not Working

I do not mean to be rude by but there was an issue from last week that a fellow user attempted to explain without being fully clear and just left it hanging: Dropdown menu problem on homepage only? I'...
0
votes
2answers
26 views

Hide review form if user has left a comment

I am trying to hide the comments form if a user has left a comment on that particular post, otherwise display the comment form. I added a code snippet to a hook which hides the form, but reverts to ...
0
votes
0answers
16 views

Connecting Wordpress with an External API

I need insight into connecting a Wordpress with an external API. This is the expected action needed to be carried out. A user tries to search on the Wordpress with four different forms fields (...
2
votes
2answers
225 views

Top Commenters: exclude admin

I'm using the following code in my function.php to display the top commenters in my theme: function top_comment_authors($amount = 5){ global $wpdb; $results = $wpdb->get_results(' SELECT ...
0
votes
2answers
497 views

Upload image and assign it's id to post

At the moment i am working on database conversation script from other cms to Wordpress and faced one problem: I have a list of images, so i need to upload it to Wordpress, after it receive new link, ...
0
votes
1answer
22 views

Fatal error: Uncaught Error: Using $this when not in object context

I am using a theme plugin that is essential for my theme. It is called PixGridder Pro. The developer website is down and they can't help me. The error given by wordress Fatal error: Uncaught Error: ...
0
votes
0answers
7 views

Cron job -many duplicate posts

i have news aggregator website and have many sources need sometime to update in one minute maybe 7 new posts i make more cron jobs in cpanel every minute,every two minutes,5minutes but problem is ...
0
votes
0answers
5 views

How to group custom posts in admin menu based off taxonomy/postmeta

I created a custom post type named cars and I am trying to find a way to display the posts in my admin menu where it will group the posts based off either taxonomy or postmeta by car manufacturers, ...
1
vote
1answer
548 views

UPDATE on SELECT results. A SQL query to swap Author with Meta Box value

I inherited a project where, for some reason, the previous developer make a custom post type for authors and a custom select listing all those authors cpt titles in the post edit screen. This led to a ...
0
votes
0answers
5 views

woocommerce pagination with custom query using wc_get_products doesn't work

I use the function wc_get_products to get the products I want. $paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; $ordering = WC()->query->get_catalog_ordering_args(); $...
0
votes
1answer
1k views

Importing Attributes in to Woocommerce

I have a text file with 100 + names, I need to import this as an attribute into WooCommerce. I’ve been searching all over for an answer but can’t figure it out. I've tried some plugins but they don't ...
0
votes
0answers
6 views

Send a email base on a taxonomy term

I like to have a email send if a custom post is created/updated if it has custom taxonomy term. The here is the CPT, taxonomy and term. Custom Post Type: Call Custom taxonomy: call_type Custom ...
0
votes
1answer
20 views

ACF Flexible Content with Bootstrap Carousel Repeater

I'm trying to add a counter for each instance of this flexible content carousel built with Bootstrap. I've tried multiple ways of counting with the while statement. What would be the correct way to ...
1
vote
0answers
90 views

Product queue for my subscription box

I'm in the process of developing my subscription box and was struggling a bit with the available solutions on the backend of my site. I only send one item (as a start) in my box every month and I ...
0
votes
0answers
8 views

retrieve thumbnail id from best selling product in category

The below is just an overview of functions etc ive used to get the resulting variable $image. The code gets the manually set thumbnail and $image is used to display the thumbnail along with taxonomy ...
0
votes
1answer
1k views

Replace “Add to cart” by a link to contact page on specific product

On my WooCommerce, I'm trying to hide "Add to cart" button and replace it by a "Contact us" button (with a link to contact page) on specific product page. I've found different snippets but they don't ...
0
votes
0answers
11 views

Code correction - Hide a profile from visitors with a specific role

The following code i tried to hide the profile of subscriber's role of user not logged in but I need it to be visible to the administrator and shop_manager, how can I do it? add_action('bp_ready', '...
0
votes
2answers
623 views

video header in desktop view, image header in mobile view

In twenty seventeen, is there an easy way to show video header in desktop view, and show image header in mobile view ?
0
votes
0answers
6 views

Conditional display of blocks

I am looking for a solution to conditionally show specific blocks on a page depending on what the user clicks. I have for example a long page with a lot of blocks showing product reviews. I would ...
0
votes
0answers
9 views

add image uploader field for users without plugin

i have made signup form in custom template. I'm trying to allow users to upload a profile image on their user profile editing page, thanks in advance. kindly help with code step by step. i have ...
1
vote
4answers
96 views

Deactivate Plugin on Theme Switch

I am developing a plugin, let's call it DahPlugin, that provides additional customizer options for a free theme I developed. Let's call this theme DahTheme (I don't want to shamelessly plug either one ...
1
vote
1answer
12 views

Sorting category products not working

I am using Avada theme and the sorting of the products on category page is not working. When i click on ascending and descending order the ordering of the products becomes random. Please provide me ...
0
votes
0answers
7 views

Why are my fields not saving to the settings API

So I create a settings page on my Wordpress site, yesterday it was working fine but for some reason now when i click save none of the values are being saved? Are there any issues with the below code? ...
0
votes
1answer
479 views

Code for creating three vertical columns in Wordpress Bootstrap theme

I am trying to make Wordpress theme with bootstrap 3.x. This is my first theme and I am experimenting with Wordpress and bootstrap various features. I would like to use Wordpress sticky post feature ...
0
votes
2answers
940 views

WooCommerce print subcategory of product

I am using Wordpress with Woocommerce, I am on the detail page of the product content-product-single.php. I created several "sub" and I have to print ONLY subcategories associated with that product. ...
1
vote
1answer
9 views

Remove block styles in the Block Editor

The Block Editor recently introduced block styles as seen below: How do we remove these?
0
votes
1answer
137 views

php preg_match with multiple patterns

I am trying to combine two preg_match patterns separate with ,|,. /blog\/page\/[0-9]+\/?$/ with /tag\/ skip in /blog/page/ and /tag/ /page\/[0-9]+\/?$/ with /[0-9]+\/?$/ ex. /page/2/ and only /2/ /(...
0
votes
2answers
21 views

WordPress Meta description - is it better to use manual configuration?

I was wondering: aside from the fact that plugins are easier to use, wouldn't it be better to configure meta description on a wordpress website manually by code in the header.php or functions.php file ...
-1
votes
0answers
20 views

Allowing Only One Registration Per Device

I want to make a option that one device can register only one account. i search plugin/tutorial but i found nothing :/ Is there any option for make this happen?
11
votes
1answer
8k views

How to run WordPress across 2 VMs for high availability

Microsoft Azure requires that applications utilize two instances across multiple data centers in order to achieve their "high availability" SLA and ensure your sites don't go down for routine ...
0
votes
1answer
26 views

How to display the featured post on the category page?

I have created a feature post check box on the post page. Now what I am doing is if any user-selected that checkbox then I have to show that post on the category page. I tried below code but it's not ...
0
votes
1answer
510 views

How to load jQuery in TOP of wp_footer?

I have added this code to load Google hosted jQuery function replace_jquery() { if (!is_admin()) { wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery....
1
vote
0answers
11 views

Woocommerce custom endpoints

Currently, I'm an android developer(Java) and trying to add some custom endpoints to my Woocommerce site. I've wasted so much time to understand concepts of WP, but still can't get clear answer. So ...
0
votes
2answers
20 views

Adding if statement

I'm pretty new to PHP however have managed to put together a site I'm happy with. Once small issue I am having is that I would like to add content for users with specific roles, this means adding an ...
0
votes
1answer
41 views

How to add a background image to category and display image on category page

I have categories on my website. I have to add a background image to each category while creating the category without using any plugin. I tried some code in function.php and I refer this link. but ...
3
votes
1answer
6k views

how can I create a calendar for a cpt, using get_calendar or other

I have a custom post type with its own date field. the date is setup for unix YYYY/mm/dd I need to create a simple month calendar that shows days that have a cpt on them. get_calendar works for ...
0
votes
0answers
8 views

WooCommerce - Product Meta total to add tax

encountered an issue on WooCommerce that i am desperately trying to fix. When adding an order (or an order is placed through the store), that on the orders edit/view screen, in the Product Meta ...
0
votes
2answers
682 views

Custom URL segment parameters for posts

I need to add a custom parameter/segment to the post URL. For example, when I have a post at example.com/post-name, I need to add another segment like example.com/post-name/places. After that, I ...
0
votes
0answers
18 views

Update block once an API request returns with a value

I've got a block that allows the user to enter a script when in edit mode, then sends this script to a REST endpoint which returns a WP_Post representing a media file which is then displayed to the ...
0
votes
1answer
478 views

Why is WordPress not using $_SERVER['SERVER_NAME'] for 'WP_SITEURL' and 'WP_HOME' as default?

I came across this site and I was wondering why WordPress isn't using this as default: define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME']); define('WP_HOME', 'http://' . $_SERVER['...
0
votes
1answer
19 views

wp_trash_post() duplicates post to trash

I'd like to move a post to the trash in the loop. Here's my code; function run_every_five_minutes() { global $post; $wp_query = new WP_Query(array('cat' => array(1), 'posts_per_page' => ...
0
votes
1answer
17 views

How to create a Child & Siblings menu for a custom post type?

I am looking to create a menu that displays the child pages when on a parent page, but to then show the siblings when on any of the sibling's pages? -Car --VW --Ford --BMW -Bike -Motobike So ...
10
votes
4answers
17k views

How do I remove the admin bar (styling) from frontend only?

When logged in, the admin bar adds the following to my page <head> section: <style media="screen" type="text/css"> html { margin-top: 28px !important; } * html body { margin-top: ...
0
votes
0answers
7 views

Woocommerce show all product variations for first attribute [on hold]

I am using standard woocommerce product variations. I have products that have both size and colour as variable attributes. What I would like to do is show all sizes in the "Sizes" drop-down but limit ...
0
votes
0answers
10 views

Display wordpress search results within the same page

<div id="photo-search"> <h2>Search Photos:</h2> <form action="<?php get_permalink(); ?>" id="searchform" method="get"> <div> <label ...
0
votes
0answers
7 views

Why dont change the cart total after change currency switcher?

Good afternoon. I use the currency switcher plugin. 2 currencies: $ and Euro. I withdraw the amount from the basket in the cap in this way. When I select the dollar in the select, only the currency ...

15 30 50 per page