Questions tagged [code]
The code tag has no usage guidance.
101
questions with no upvoted or accepted answers
3
votes
0
answers
38
views
Date/time limitation of posts where function must be executed
I have this piece of function in my functions.php file:
function user_content_replace($content) {
$sentences_per_paragraph = 3; // settings
$pattern = '~(?<=[.?!…])\s+~'; // some punctuation and ...
3
votes
2
answers
899
views
Including Angle Brackets In Pre Sections
I am attempting to post some java code between pre tags but the angel brackets get removed. For example:
private HashMap<String, HashMap<String, Integer>> featureCounts;
becomes
...
2
votes
0
answers
1k
views
source code: WP_INSTALLING vs. WP_SETUP_CONFIG in setup-config.php
I am trying to make sense of the wordpress installation process.
The file setup-config.php under wp-admin has the following.
I want to know what the difference is between these two variables,
why both ...
1
vote
0
answers
45
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 ...
1
vote
0
answers
84
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.
...
1
vote
0
answers
129
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 ...
1
vote
0
answers
66
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(...
1
vote
1
answer
55
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
1k
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 ...
1
vote
0
answers
455
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 ...
1
vote
0
answers
487
views
How to remove all comments from JS, HTML, CSS files?
How to remove all comments from JS, HTML, CSS files?
I found this to remove comments from HTML, but is there a straightfoward way to do it also from all included JS and CSS files?
1
vote
0
answers
25
views
I got an issue after i migrated a site
I recently migrated a site to a larger server. Everything appears to be fine, the site works everything transferred over. The site does have an SSL cert.
Recently we started to get flagged as unsafe ...
1
vote
0
answers
29
views
Is there a way to create embed codes from wordpress/buddypress content?
I am looking for a way to create embed codes for content like, posts, images, videos, comments and buddypress content and components to be posted on external websites and apps.
So for instance ...
1
vote
0
answers
225
views
Send notifications to custom post author when custom post is edited
I've made a custom post type that works as a ticket service. I need to send notifications to the owner of that post (author) when the post is edited (changes status or has been saved), usually edited ...
1
vote
0
answers
47
views
wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
I need a Function Code to improve the wordpress search engine
For example, if the user searched: Hello world
First, the results of Hello + World are searched
and the next results: Hello and world
...
1
vote
0
answers
176
views
Why namespaces are rarely used in WordPress plugins?
This is currently my impression. Many WordPress plugins I used do not use namespaces. On few occasions, on this website, I saw namespaces are good and should be used. Are there any drawbacks using ...
1
vote
0
answers
209
views
What data validation we must use in different contexts?
Recently, my theme got rejected on Themeforest and one of the rejection issue is:
Data Validation issues have been found in your theme. All dynamic data
must be correctly escaped for the context ...
1
vote
0
answers
28
views
Need To Post Unformated Code
Im wanting to use wordpress to share some code snips. However when viewing the posts some of the code tries to format even though its in pre or code tags. Is there anyone way to modify
<?php ...
1
vote
0
answers
66
views
Wordpress editor removes all the linefeed characters with WP-Markdown and Syntax Highlighter evolved
I have WP-Markdown and SyntaxHighlighter Evolved wordpress plugins installed.
The issue is that when I write the code, and click the "Update" button, I have the code reformatted.
[ruby]
class Foo &...
0
votes
0
answers
8
views
how can i Add the code
how can i Add the code to my site before the closing tag?
code is
(function(w,d,u){ var s=d.createElement('script');s.async=true;s.src=u+'?'+(Date.now()/60000|0); var h=d.getElementsByTagName('...
0
votes
1
answer
19
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
13
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
18
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
21
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
19
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
0
answers
22
views
I need help with removing words or changing bulk slugs
Heres the best example.
urls are in a domain.com/locations
they say domain.com/locations/used-honda-cbr-goldwing-in-sarasota-fl
I need them to say: domain.com/locations/used-honda-cbr-in-sarasota-fl
...
0
votes
1
answer
29
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
255
views
Convert Image to Webp on upload without plugin
I try way to convert image on upload automatically.
I try a lot of plugins but all of that work over .htaccess and make duplicate image in upload folder example. imagename.png.webp
I want convert ...
0
votes
0
answers
24
views
I have custom html mixed with inline javascript that I want added to my WordPress site, how do I achieve this?
I have the following HTML/JS code:
<div style="position:relative; transition: all 0.3s cubic-bezier(0.65,0.05,0.36,1); height: 0px;">
<iframe
width="100%"
...
0
votes
0
answers
131
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
12
views
May I know where to edit the tax rate?
I'm newbie in Wordpress. Our company website using the shopper as theme.
But where can I find this part and change it?
0
votes
0
answers
32
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
0
answers
6
views
I want create woocommerec match products columns
I have created three columns. In two columns I want to add woocommerce products (e.g bottoms in one and tops in another) and for third column I want it to be populated from products present in tops ...
0
votes
0
answers
19
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 ...
0
votes
0
answers
50
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
32
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
431
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
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
33
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
16
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 ...
0
votes
1
answer
169
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
82
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
0
answers
348
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
60
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
0
answers
166
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
0
answers
68
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
27
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
...
0
votes
1
answer
1k
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
246
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?