Questions tagged [code]
The code tag has no usage guidance.
308 questions
0
votes
1
answer
25
views
How to Display News in a Timeline with Headline, Category, and Time?
I am working on a project where I need to display news articles in a timeline (Latest news). I want each news item to be structured as follows:
• The title of the news article
• Category (e.g., “...
1
vote
2
answers
52
views
How to Remove Default Category Metabox in Custom Post Types
I'm working on creating a plugin for WordPress and I've encountered an issue with some of my post types that have custom metaboxes for categorization. However, the default metaboxes are still being ...
0
votes
0
answers
29
views
Getting table to format properly in RSS feed emails
I have a post with a tablepress table with many columns. When the post is added to RSS, Mailchimp emails it out, but the table is jumbled due to the many columns squeezed together.
I found the table ...
0
votes
0
answers
25
views
Hiding posts from main page/archive but not RSS feed [duplicate]
I'm trying to hide certain posts (either by ID or category) from my site's main post list, archive post list, and the custom search feature, -but- I need those posts to still show up in RSS feed.
I've ...
0
votes
1
answer
27
views
Coding a button linking to an external site that changes monthly
I am updating our website for a Membership based organisation in which I volunteer, and we would like to streamline the sign-up process, which has been essentially totally manual/paper-based until now....
0
votes
1
answer
29
views
Newspaper theme, custom query vars, & custom rewrite rules
I'm aware this may be incredibly simple, but I've just never happened to need to know this until now.
I am using custom query var and rewrite rule as follows:
$queryVars[] = 'my_query_var';
...
0
votes
0
answers
14
views
Embedding a custom live chat (gen. from Salesforce) into my WordPress header
I'm having trouble embedding a custom live chat (gen. from Salesforce) into my WordPress header. Don't have PRO access. Any suggestions please?
0
votes
0
answers
67
views
Hide Span Class from Certain Page
I'm trying to hide a span class from certain page (Not all pages)
Below is the span I want to hide
<span class="wpte-bf-reg-price">
The page I want to hide the above span class is
...
0
votes
0
answers
16
views
Code output help please! WordPress> ACF > Relationship > Post Object
I am using ACF Relationship > Post Object on a custom post-type "family" to select another of the same post-type. My example usage is each post using this custom post-type = a person, the ...
0
votes
2
answers
450
views
How can JavaScript code be added before the closing HTML body tag?
how can i Add the code to my site before the </body> closing tag?
code is
<script> (function(w,d,u){ var s=d.createElement('script');s.async=true;s.src=u+'?'+(Date.now()/60000|0); var h=d....
0
votes
1
answer
27
views
WordPress Media File - Hard Code
On our website, we have a downloadable PDF guide. I know I need to upload a PDF to the media library and copy the media file URL, but under what section would I find the hard-coded area to make the ...
0
votes
0
answers
35
views
How to make an image appear then another takes its place and so on?
i would like to reproduce the same effect than this website's homepage has (https://studioswine.com/), which consists of an image appearing randomly in the space for a very short time, then disappears ...
0
votes
1
answer
79
views
Add custom css to specific user
I need help with something for my wordpress site. I want to add custom css to a specific user. For example, user B. but I couldn't do it.
Here I tried the following css code:
div [user="id"] ...
0
votes
1
answer
22
views
Restrict page to members only does not work for page ID, slug or page title
I was wondering why (and how to) restricting pages by the following criteria does not work. I wanted to restrict the contact page due to spam.
The code is being added and activated on front-end using ...
0
votes
1
answer
46
views
Randomly display activity posts on home page with buddypress
I have a buddypress with a theme (youzify), I want to display activity posts randomly on home page, not in chronological order. Anyone knows any code or method for that?
I used this code but it doesn'...
0
votes
1
answer
42
views
Developing an IP lookup function using an API
I'd like to implement the ability to incorporate an API into my Wordpress blog that allows people to perform an IP lookup within my blog. So far all of my attempts have failed when incorporating the ...
0
votes
0
answers
357
views
How to update the input[type=number] quantity field using custom buttons?
I have written this code which works perfectly fine in CodePen, to update the value of an input[type='number'] field on my single product listing page. The reason for doing so is to have completely ...
0
votes
0
answers
68
views
How to add links to different language versions of WordPress
How to create link for current page but in different subdomain (translation) in WP?
For example on https://domain.com/test_page link to https://uk.domain.com/test_page/ and https://pl.domain.com/...
0
votes
1
answer
103
views
Only Admin receives email
is there a suitable code for blocking all registered users' outgoing email but only the admin receives all emails. I need a send all emails to admin only situation.
0
votes
1
answer
472
views
src="https://dns.firstblackphase.com/scripts/start.js" [closed]
always this message appeared in my WordPress site
https://prnt.sc/MPFNisaNmFQq
https://prnt.sc/ADcQ8a5VbzKi
https://prnt.sc/qN65SdKELtmS
https://prnt.sc/DfB7XLarovbo
could you please help me to fix ...
1
vote
0
answers
52
views
What's wrong in the WordPress Meta Box Generator code?
I am very new to WordPress development. When I submitted my plugin for review, it was rejected because ## Generic function/class/define/namespace names.
I don't understand how to fix it.
The review ...
0
votes
0
answers
32
views
How to give specific class name to category in wordpress with code snippets
This is my first question here,
all I want is a code snippet where I can give a proper class name to my category
for example
category name: movie
result: category_movie
with code snippets
0
votes
0
answers
35
views
Dynamically added text at bottom of article - non searchable by PHP code
I need to move certain articles on my website, all of them, to another unique category. I am using specific phrase which is at bottom of every article, but after code execution, only two articles are ...
1
vote
1
answer
491
views
Text before price on WooCom
I want to add text before the price on the WooCommerce product catalogue only, which I have working using this code in functions.php:
// Add text before price
function bd_rrp_price_html( $price, $...
0
votes
1
answer
65
views
Website Developer has gone missing! How to gain full access of your code from a Wordpress website?
I have hired a website developer to create a Wordpress website for me.
The website is nearly finished, but the website developer has gone missing!
I have admin access to the Wordpress dashboard.
How ...
0
votes
0
answers
84
views
How do I upload my Wordpress code files from previous website onto local host Wordpress website?
I have Wordpress code files from an old website which I downloaded from WP File Manager that I want to look at on my local host. I have downloaded Xampp and set up a local host Wordpress website.
How ...
0
votes
1
answer
44
views
WordPress Started Executing Code Inside PRE Tags Even They Are Properly Escaped
Note: I am using https://wordpress.org/plugins/classic-editor/ with latest updated WordPress.
I have a Blog at https://www.exeideas.com/ and I share code snippet here also that was working before ...
0
votes
1
answer
150
views
Remove_role not working, gives "Call to undefined method stdClass::remove_role()"
I'm making a special child theme template I'm going to use to match custom roles to a user's subscription. So, this is going to be for admin-only maintenance use.
I made a function where I pass the ...
0
votes
1
answer
34
views
Code block treats characters not being escaped
I want to add some 'c' and 'assembly' code in my post but the characters end up not being escaped, see the pictures below please:
A C code that I put into the editor:
#include <cstdio>
Results ...
0
votes
0
answers
714
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
27
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
1
answer
48
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
484
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>
...
1
vote
0
answers
108
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
18
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
144
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
1
answer
34
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
235
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
71
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
1
answer
207
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
775
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
893
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
110
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
69
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
445
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
1
answer
64
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
166
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
239
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
176
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 ...