Questions tagged [code]

The tag has no usage guidance.

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

Adding custom styles to dropdown in editor

is it possible to add a custom style to the dropdown in the classic WordPress editor, say a div with the class of "fancywords"?
0
votes
0answers
10 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 ...
0
votes
0answers
15 views

Change page post status based on acf field value

I’m kinda newbie to coding, I have just made a new wordpress site that uses advanced custom fields on backend (all fields are global fields in added options menu) from where front end pulls the values ...
1
vote
1answer
35 views

How to make this WP_Query run faster on a WordPress website?

This code is part of a custom WordPress homepage that shows the 7 most recent posts using WP_Query, and the first post has a custom html structurer, while the rest has another html structure. Then ...
0
votes
1answer
16 views

How to put 2 php codes in functions.php without site crashing

I can use either the php script for a menu <!-- menu --> <?php function wpb_custom_new_menu() { register_nav_menu('my-custom-menu',__( 'My Custom Menu' )); } add_action( 'init', '...
1
vote
0answers
11 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?
0
votes
0answers
8 views

how to display the number of posts in different on pages 1, 2 and 3

I want to create a page that displays the following number of posts. Page 1 or home = 7 posts Page 2 = 5 posts Page 3 and so on 15 posts. What is the code to display it?
-1
votes
0answers
15 views

Keywords tag is not showing

I don't have money to buy Yoast SEO. So I have added some tag manually in the header in my WordPress website such as description and keywords tag. Description tag is working properly but the keywords ...
0
votes
0answers
17 views

Change code URL

is it possible to change to the url of images on the code source i'm finding a problem with redirection so the best thing to do is to begin all the image src url with /wp-content/
0
votes
0answers
6 views

Download button for all gallery images in WooCommerce product page

I'm trying to figure out a code to download all gallery images under each and every product with one press of a button. Thanks! Regards Rasmus
0
votes
1answer
20 views

Call to Action Button - Resize Help [closed]

I need help with resizing the "free quote" action button on my website. It is placed on the menu on the right top corner. I need to resize it to smaller size so that it fits the size with other text ...
1
vote
1answer
27 views

How to get the POST TITLE using the POST ID?

I made a page with several POST IDs that I get from the Table of a plugin. Now the page is showing like: 3249 3250 3251 3252 (Post IDS) I wanna show the title of those IDs like 3249 - POST TITLE ...
0
votes
0answers
13 views

Retrive and display first numbers seperated by commas in post content

function find_the_number() { global $post, $posts; $first_number = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/^[0-9,]+$/', $post->post_content, $matches); $first_img = $...
-1
votes
2answers
54 views

I want to add the alt attribute to all the photos!

Hello everyone and I found you well, I have a problem with a dynamic site that contains over 200,000 photos, it is a news site. The site is built on the WordPress platform and has many changes to suit ...
0
votes
2answers
48 views

How to run wp cli from a wp hook?

How can I run a wp cli command when a wordpress hook is called on my website. On user registration hook, I would like to run a wp cli command to activate a license.
0
votes
0answers
12 views

Search by tags and categories only

I recently changed themes for my blog and somehow changing the theme interfered with my Snippets plugin for my custom search code to only search for tags and categories. What I'm trying to achieve is ...
0
votes
0answers
13 views

Display of code in Post Error

Im trying to post some lines of code in a blog post and Im having some difficulties with SyntaxHighlighter Evolved plugin. According to the documentation, to write some python code i should be able ...
0
votes
1answer
24 views

&nbsp; &nbsp; &nbsp; &nbsp; out of nowhere

Something is inserting four non-breaking spaces into my single.php code, but I can't find the cause at all. I have already tried to disable all plugins and restore the theme's initial settings. Link:...
0
votes
1answer
38 views

How set a while with a function

i have a simple function and i need that while it execute my function it set a variable to true, otherwise false. the execution would be my condition. while run this func function need() { ...
0
votes
4answers
285 views

how to edit source code of specific page in wordpress?

i am taking a hard time to figure how to do it. I have three different pages in my wordpress installation besides the Homepage. I need to edit each one of them separately, remove header, footer and do ...
0
votes
0answers
6 views

How to create table of content from page title tags?

I'm looking for a code snipet for automatically generating a table of content taht i can add inside the php page of the article. Basically the table of content should be generating title tags with ...
0
votes
1answer
46 views

How to escape html generate by a loop

I have the following code which is flagging a warning that I've been asked to fix by my theme reviewer. WARNING All output should be run through an escaping function (see the Security sections in the ...
0
votes
1answer
13 views

Different Google Analytics code based on Users Device

Our site has an odd GA set up with two different GA codes, 1 for desktop, another for mobile. (We use dynamic serving of website code to send different code based on User agent.) Now we have a blog ...
0
votes
0answers
5 views

Need to edit Top Ten List plugin so list descends instead of ascending (need 10-1)

I want to edit a wordpress plugin that lets me create a top 10 list. I want to make the list descend instead of ascending. Here is my new site I am working on: [https://freshergear.com/top-10-...
0
votes
0answers
11 views

Create Code Spoiler in the post [duplicate]

My purpose is for foreign language blog. Specifically used for displaying sesame words and examples related to vocabulary. As shown in the picture, the number 1 is in the normal state. Number 2, when ...
0
votes
1answer
106 views

My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!

I'm new to WordPress custom theme development. I am using a child theme for OceanWP. I have a webpack setup to hot-reload my files but my js scripts are not getting sent to my WordPress site instead ...
1
vote
1answer
229 views

Firefox CSS Animations Broke [closed]

After updating to the most recent version of Firefox I am having issues with my CSS Animations. On my website of camerabeanbags.co.uk I have animated buttons where the gradient is animated across the ...
0
votes
0answers
28 views

Need help refining added code in functions.php

I need an extra set of eyes to help me fix code that automatically sets any post to private so only the admin can publish any post draft. The problem I'm running into is that every time a user clicks ...
0
votes
1answer
287 views

Displaying SQL query result from user input via wpdb

I'm a bit stuck with one of my task which is to require a user input for an 'ID no' and it shall go through a table in my WP and display the result on the same page (after hitting Submit). I'm ...
0
votes
1answer
99 views

How To Export User's Custom Fields in CSV or XLSX

Hi Guys I have a BIG problem.. I'm using Eduma LMS and I have 2 type of customers... Some buy single video course, some others buy a membership (managed by Paid Membership Pro). When a user buy a ...
0
votes
0answers
15 views

Thumbail after first paragraph

I try to make future image display after first paragraph with this functions.php code: add_filter( 'the_content', 'insert_featured_image', 20 ); function insert_featured_image( $content ) { $...
0
votes
0answers
13 views

Issue with Transparent Navbar on First Load

This is a test website I am i the middle of created – http://newsite.camerabeanbags.co.uk The issue I am having is that the Top Navigation Menu/header should be transparent when the page is at the ...
0
votes
0answers
19 views

Add panels with images and description in wordpress

Good day! I wanted to add a panel into my website homepage complete with panel heading and body. I also wanted to add an image inside the panel body but I have been very unsuccessful. I have been ...
0
votes
0answers
21 views

Code to insert TAG taxonomy Wordpress

I made a grave error. I delete many TAGs from the database of my blog. Many TAGs were orphaned. And yet, unfortunately, many posts have anchor words that link to deleted tags. That is, several links ...
0
votes
1answer
28 views

How do I prevent Wordpress from eating my code?

I'm writing a guide and putting code examples. If I use the visual editor the code indentation is lost. It will also take some code and strip it out. If I use the text editor I can't ever switch to ...
0
votes
0answers
42 views

load plugin in code snippet

I'm using "PHP code snippet" in my WordPress website to create a "form" so i can read and write back to my database. Is there a way i can make a "text-area" with style editing options instead of ...
0
votes
1answer
30 views

How to code custom special page

I'm looking for how to code custom "special" page as use many plugins. An idea is that I have in theme links to the custom special page. Then admin can chose which of his pages is the one "special" ...
0
votes
2answers
2k 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
1answer
1k views

Fatal error: Uncaught Error: Call to undefined function get_header() [closed]

Fatal error: Uncaught Error: Call to undefined function get_header() in C:\xampp\htdocs\allegiant\index.php:1 Stack trace: #0 {main} thrown in C:\xampp\htdocs\allegiant\index.php on line 1 I ...
0
votes
1answer
177 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="...
0
votes
2answers
32 views

Code is providing a row of data but not formatting it as table

I am using the following code: function seconddb() { global $seconddb; $seconddb = new wpdb('username','password','g3boat5_G3_Genba','localhost'); } add_action('init','seconddb'); // add the ...
0
votes
1answer
488 views

Display Data in Table from External Database in WP using Shortcodes

I have successfully coded a secondary database connection for my wordpress site in the functions.php file in wordpress. I have used the following to create shortcode and run the data to my table where ...
2
votes
1answer
977 views

Connect Second Database to Wordpress

I am trying to connect a second database to my wordpress site so that I may ask for data from it and display it in a table on my site. I have tried multiple ways of doing so. I have tried to use php ...
0
votes
2answers
43 views

Search Count Wordpress Theme

I have a code that displays results for search but, I need it to include the count not just keyword searched <h1 class="font-thin h2 m-b"> <?php printf( esc_html__( 'Search Results for: %s',...
0
votes
2answers
71 views

How can I put my own code in a wordpress page?

How can I put my own code in a wordpress page? This happens when I tried to
1
vote
0answers
24 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 ...
0
votes
0answers
29 views

How to add specific posts to specific pages in WordPress?

How can I add specific posts to specific pages in WordPress using custom fields and not categories? Actually, I want to assign a specific custom field value to different posts and show them on ...
0
votes
1answer
115 views

How do I validate extra pin field on my WordPress login form page?

I have been able to add an extra field to my WordPress login form using the following code inside wp_login.php file, thanks to stackxchange. add_action('login_form','my_added_login_field'); function ...
0
votes
1answer
19 views

Client on iPad accidentally adding <code> tag to posts while writing

A client of mine complains that text gets 'randomly highlighted' when he is writing Wordpress posts on his iPad Pro. He uses the web interface. I got him to stop deleting the 'highlighted' text and ...
0
votes
1answer
105 views

Changing input type from text to multi select dropdown - skill taxonomy

Really need help with a wordpress code please. I have a field on a form which adds tags to the post. Problem is, its free for anyone to enter anything. This keep populating the "skill" taxonomy. The ...

1
2 3 4 5 6