Questions tagged [code]
The code tag has no usage guidance.
287
questions
0
votes
0
answers
11
views
Allow login only for one account from one device
Hi All i hope all you are ok .
i am working on a membership website , and i want to prevent user from shared there paid account to other people , meaning that the registered account attached to ip so ...
0
votes
1
answer
20
views
Can I do in-page changes binding events/triggers to actions in WordPress?
I've been coder for decades but I need to setup some microsites super-fast. I chose WordPress as the platform and I'm complete newbie to WordPress.
The behaviour I need I know can do it programming. ...
0
votes
0
answers
25
views
Display a specific category in a focused area of my site
I've been trying to change the code of my WordPress site. Rather than showing "trending posts" which is determined by post_views_count, I simply want to show posts from a certain category. ...
0
votes
0
answers
17
views
Counting number of posts in multiple (sub)categories using shortcode
I'm making a new cycling team website and on the home page i have 3 different type of stats: "Win, Podium and top-10"
Now i want the number of the stat go up if i post something with for ...
0
votes
0
answers
21
views
Need help for some PHP code
I've already set all the fields in my theme settings but I want that carousel-items class repeats whenever I add slides to it, and [0] changes to [1],[2],...
<div class="carousel-items"&...
0
votes
1
answer
21
views
code block does not show in excerpt
I am creating some blog pages with example codes, and I would like to show the codes in excerpts, but WordPress automatically excludes code blocks from excerpts, is there a workaround for showing code ...
0
votes
1
answer
93
views
Why does HTML entities are still encoded in Code Block?
In the Code Block if I type in reversed character, they are encoded to HTML entities:
Input:
Output:
<pre class="wp-block-code"><code>'[] </code></pre>
...
0
votes
0
answers
39
views
Save Meta when custom Taxonomy Saves
I am in need of some advice, we are setting up a custom tag for Movies. We want to have it pull from the OMDB Api when it is saved. We have the function setup, but it is not firing, and I am stumped.
...
0
votes
1
answer
14
views
How i can remove Working Functionality of my header & footer plugin from backend files but in front end plugin need to show that plugin activate
I have a question actually I have a website in which one of my friends is using too many scripts in the header & footer using header & footer plugin in WordPress so I just want to stop the ...
1
vote
0
answers
41
views
How to save checkbox values for logged in users?
Hello~ How can I have checkboxes save their values for a logged in user?
My Wordpress website features various checklists in a table format. When a user finishes a task on the list, they would be able ...
0
votes
0
answers
22
views
Woocommerce display orders with products from specific categories to specific admins
I am new at stackoverflow. I have a question about wordpress. I am building a wordpress site for some cinemas with movies. Each cinema is a product category. I want enable an admin cinema1 which will ...
0
votes
1
answer
20
views
Woocommerce template file outputting <strong><code> tags
I'm struggling with the editing of the woocommerce template files. In particular, I'm trying to create a custom cart page and, as guidelines, I've copied the cart.php template file to my template ...
0
votes
1
answer
35
views
Reorder a page of posts of a certain taxonomy/value by a custom field
I want to re-order a page of posts of a certain taxonomy/value by an added Advanced Custom Fields PRO field, instead of the default (ordered by post-date).
We have a WP site with a custom taxonomy, ...
0
votes
1
answer
18
views
remove edit link only for published post and pending post
Currently i m using this shorocdes
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions( $actions )
{
if( get_post_type() === 'post' )
unset( $actions['edit']...
0
votes
0
answers
73
views
using add_filter in a template_redirect function?
I have certain pages that I would like to filter, replacing some tags, with a value. Rather than attempting to filter every page, I only want some pages, but to make it use even less resources (not ...
0
votes
0
answers
25
views
Automatically Close wordpress media uploader after click on upload image
i am using one function for automatically insert image in post after user upload image in wordpress media uploader but problem is that wordpress media uploader is still open after user upload image. ...
0
votes
1
answer
40
views
Copying and pasting to Wordpress "code editor" code via the front end and clipboard
I'm trying to emulate what these folks do with their "Copy code" button: https://gutenberghub.com/templates/team-56
Their approach is great for copying to clipboard and pasting directly to ...
0
votes
1
answer
207
views
How to create a checkbox to show/hide a field in WooCommerce checkout [closed]
I want to put a checkbox before all fields where I want to ask people if they have vat number and when they check that checkbox I want to display vat_number field, also when isn't checked I want to ...
1
vote
1
answer
182
views
Wordpress wp_insert_post() returns 0 but not not wp_error
wp_insert_post() return value says:
(int|WP_Error) The post ID on success. The value 0 or WP_Error on
failure.
Okay, I' have an import routine running and all but a few (about 20) of them import ...
0
votes
1
answer
42
views
how to display google maps with javascript
I want to display one google custom map with javascript, I set this code in a code module, but when I post it only appear the code and not the map, how can I display my map correctly? The code works ...
0
votes
1
answer
43
views
How to make my homepage automatically redirect to an external website?
Actually, I have a website hosted by my University.
They claim that it is my personal website or whatsoever, but they do not give me full control of it!
I cannot install plugins, change the theme, or ...
0
votes
0
answers
153
views
How to preload header logo image in WordPress? like what's the code and where do I put it?
I want to preload image in header i.e. Logo, so what is the code for that and where do I put that logo?
Thanks!
0
votes
0
answers
16
views
I would like to add a review count of a particular website in to my blog and that it should update automatically every time it changes
Hey i would like to be able to add a review count from google reviews or trustpilot of someone else website that i am writing about them in my blog. i would like it to be accurate and therefore update ...
0
votes
1
answer
34
views
restrain filter on get_the_excerpt to queried item in stead of current post
So, I have a walker nav menu who add the page excerpt to all page links in the nav menu.
Now, I want to build a custom post excerpt for the blog archive.
All works fine when the nav menu doesn't meet ...
0
votes
1
answer
39
views
How can I create a shortcode to show the number of posts of actual day?
I want to create a shortcode to display the posts posted on actual day.
I found this code:
show number of posts posted today
And I'm trying with it, but return 0
function ts_day_f() {
// we get the ...
0
votes
1
answer
60
views
Make order notes field at woocommerce checkout only viewable on front end by Admin level user role [closed]
I have a snippet of code that allows me to hide the order notes field at checkout for all users (logged in or not) but wanted to ask if someone has written a snippet that hides the same field from ...
0
votes
1
answer
54
views
CSS properties in textarea in the Customizer
I am trying to create a custom field (text/CSS code in textarea) that include the CSS suggestion like Additional CSS in the customizer:
https://i.postimg.cc/9QhLPgVk/image.png.
Does everybody has ...
0
votes
0
answers
66
views
Problem with MEMCACHE and Redis with wp_options
I have developed a plugin for worpress but it is giving me problems when I start MEMCACHE o REDIS CACHE.
I have been told that the problem is that I am using wp_options directly and that I should ...
0
votes
1
answer
24
views
Code snippet to show current php version inside "At a Glance" box in admin
Could somebody provide a code snippet which would show current php version inside the "At a glance" box win Wordpress admin? There are plugins but I'd like to do it with a code.
0
votes
1
answer
30
views
How to pass https://achecker.ca/ validator? [closed]
i have to pass https://achecker.ca/ validator for a client without any "known problems" an i recieved this message
Success Criteria 1.4.4 Resize text (AA)
Check 117: i (italic) element used.
...
0
votes
2
answers
43
views
wordpress prepare error
this is my code:
$terms = wp_get_post_terms( $listing_id,'job_listing_category' );
if(!empty($terms)){
$sql_terms.=" AND (";
foreach($terms as $term){
...
0
votes
0
answers
36
views
WP search box on page not finding .PDF files
Current marketing person left the business and I'm filling the role for now.
Receiving code from search page which formally was able to locate .PDF files by typing in and searching by key word(s.) The ...
0
votes
0
answers
21
views
Adding code to send referrer on login page
I have a code i need to add to the wordpress/woocommerce login page
function fix_lack_of_referrer_login() {
?>
<meta name="referrer" content="origin">
<?php
...
1
vote
0
answers
32
views
Adding custom field in all widgets, but at the top of the form, in admin area
I am creating a cute new functionality on my theme that requires to add a custom field to all widgets forms in the admin area. I managed to do so by using the in_widget_form hook:
function thefunction(...
0
votes
1
answer
20
views
Shortcode with loop stacks output
I found some shortcode to display a custom post type, but it's not display how I envisioned.
Originally the shortcode only added the title from my custom post type, but I modified it to also show the ...
0
votes
1
answer
367
views
Changing the Default New User Notification Email
I've been trying to edit the automatic email sent by WordPress to users when they register for my site. Currently, they register on a form made by the plugin called Forminator. However, the WordPress ...
0
votes
1
answer
113
views
Adding a schema code to one specific page using functions.php file
I would like to add a schema code I have generated to one specific page on my website using functions.php file on my child theme. How do I do this?
1
vote
1
answer
194
views
How can I upload an image for background use using the Theme Editor in Wordpress?
I'm learning Wordpress from the book Wordpress for Dummies. The author says to open the theme editor then use the style.css sheet. I uploaded the image to the twentyseventeen image folder via ...
1
vote
2
answers
626
views
Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
I'd like to completely disable RSS feeds on my WP website. Can someone please guide me on how to throw a 404.php page and set the headers to 404, when someone types in https://example.com/feed/
here ...
1
vote
1
answer
35
views
Nested Code Snippets [closed]
I'm new to wordpress and I'm trying to accomplish the following goal:
I have a custom type albums seeded by a plugin and I would like to display this data in a list.
I installed the Code Snippets ...
1
vote
3
answers
550
views
The custom logo, site title, and description doesn't appear at the same time
The problem I'm having is the custom logo, site title, and description won't appear at the same time. In image 1 below, you can see that with no custom logo, the site title, and description appears ...
0
votes
0
answers
84
views
JQuery script working locally on desktop, not working on Wordpress + Divi
So I have to map an image, and I chose to use jQuery. The code works perfectly on my desktop, in the browser, code editors, etc. But whenever I try to port it to the WordPress website I'm managing (...
1
vote
1
answer
39
views
code is working properly in Core PHP but writing coding in WordPress
function generate_pdf($array)
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="sample.csv"');
$fp = fopen('php://output', 'wb');
foreach ( $array ...
1
vote
1
answer
50
views
Hide wordpress field if data is empty in post!
I'm using this code to show my field:
<?php echo '@ ' . get_post_meta(get_the_ID(), 'Author:', true); ?>
When I add a field in my posts it shows it with no problem but for posts that I don't ...
0
votes
0
answers
57
views
Wordpress Sticky Post Count "Fix" Breaking Pagecount by 72 pages!
I have a permanent sticky post on my front page and have implemented the code (pasted below) into my functions.php file to stop it adding an extra post to my post count on the front page (it's a grid ...
1
vote
1
answer
482
views
How to add an automatic refresh in Wordpress for a Page/Post or an embedded OneDrive/Excel HTML Code?
I have added an embedded Excel sheet on my website's home page. It is always displaying live data which is changing all the time. But when me or my colleagues view that page, they need to refresh the ...
0
votes
1
answer
26
views
How to generate random codes that have to be entered to access a Mailchimp form?
I want the code to show up somewhere on my landing page. Users will have to enter it into a form before they can enter their actual details. I've heard that interaction and tiny challenges increase ...
1
vote
0
answers
308
views
Changing wordpress publication date to ACF date and time picker date not working
This might be a long post but I want to explain in detail what I'm trying to do and what I've already done.
I'm making custom forms using the advanced custom fields plugin and I need to display these ...
0
votes
1
answer
247
views
How to display content if user meta data isn't empty with shortcode
I need to display content if user meta data isn't empty
Example :
[empty_user_meta="last_name"]
Show only if last_name is not empty.
[/empty_user_meta]
Code don't work :
add_shortcode(...
0
votes
1
answer
1k
views
advanced custom fields and contact form 7
I want to use contact form 7 shortcode in advanced custom fields
I created field called shortcode with advanced custom fields
and put the contact form 7 shortcode in it.
it displayed the form as ...