Skip to main content

Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

How do you find the logo code on theme file or where can I find the header theme file?

I am trying to find the header.php file and/or the code for the logo on any theme file. Under appearance- editor section of my website ( www.pithandsubstance.com ) I can only find function.php and ...
1 vote
1 answer
2k 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
0 answers
23 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
26 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
6k views

admin-ajax.php 400 bad request - whats wrong with my code?

I'm getting a 400 bad request from admin-ajax.php & warnings from pagespeed insights tell me it's an issue. Can you see any obvious issues in the code in our admin-ajax.php file? <?php /** * ...
0 votes
1 answer
22 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
2 answers
737 views

Open all external links in new window - need help with the code

I'm using this code to open all external links in new window (site is based on Wordpress): /* OPEN ALL OUTBOUND LINKS IN NEW TAB */ function autoblank($text) { $return = str_replace('href=', 'target="...
3 votes
2 answers
922 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 ...
0 votes
1 answer
2k views

How to get tags and categories?

I used the following code to get tags from the post and then simply echo them: $posttags = get_the_tags($post->ID); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ', ';} ...
0 votes
0 answers
11 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
30 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 ...
1 vote
2 answers
2k 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
0 answers
15 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
237 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
3k 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 ...
0 votes
1 answer
50 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
23 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
23 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
35 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
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
0 answers
183 views

How to increase width of code block in WordPress blog?

I am new to writing blogs on WordPress and facing when adding code snippets (Java/Scala code). Whenever I add code snippet and choose codeblock in the blog, since width of code block is too small ...
130 votes
4 answers
242k views

How to display SQL query that ran in query?

I have come across a function before that displayed the exact SQL code that was used. In a loop for example, but can't remember. Can anybody tell me that function?
0 votes
1 answer
38 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
2 answers
5k views

Accidentally deleted php code in Wordpress website [closed]

I have a website: www.convert2latex.com . While trying to remove the "continue reading", I accidentally deleted some code and updated it in the theme editor's functions.php. Now the website does not ...
0 votes
0 answers
246 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
50 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
86 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
468 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
51 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
1 answer
43 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
0 answers
24 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 ...
8 votes
2 answers
871 views

How to get a variable number of posts per post type on the main loop?

I'm looking for a way to balance the content at the homepage of my blog: the blog has a few post types like Poscasts, Videos and Blog and I'd like to have let's say 10 Posts on the homepage, but I'd ...
1 vote
1 answer
407 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
60 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
68 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
128 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
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 ...
1 vote
2 answers
19k views

Wordpress redirect all 404 pages to the Homepage

I want to redirect all 404 error pages on my WordPress site to the homepage, or to a specific page. Any advice?
0 votes
0 answers
643 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
43 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
441 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>'&#91;] </code></pre> ...
1 vote
0 answers
100 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
143 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
216 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, ...

1
2 3 4 5
7