Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

0
votes
0answers
4 views

How to call wordpress functions from a form processing script

I'm working on a plugin which submits data via a form from a custom admin page. This is a simplified version of my form: <form action="<?php echo plugin_dir_path(); ?>/process.php" method="...
0
votes
0answers
12 views

I want to get the pure image tag using php on wordpress

I hope everything will be fine in near future for everyone. By my default editor (wysiwyg) on wordpress, the code of inserted image are shown like below: <div id="attachment_18" style="width: ...
0
votes
0answers
10 views

Download PDF after CF7 form submission

I'm working on a client's build, and I'd like to change as little as possible. I'm not too familiar with all this, my apologies - I'll try to show where I'm at. The client wants a form submission to ...
-1
votes
1answer
19 views

Notice: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in …functions.php on line 73

When I tried to edit my menu, it appeared HTTP ERROR 500 Then I set define('WP_DEBUG', true); in wp-config.php Once I try to save the menu, the following error appears: Notice: Use of ...
0
votes
0answers
10 views

Music Charting site [on hold]

I need to build a website that will chart songs and artists according to number of plays and votes. The songs will include those that the artists from my school upload onto this website as Mp3 files ...
0
votes
0answers
11 views

Variable function names

I am working on a plugin that will add messages to a WooCommerce product at set places on a single item/product page and run into an issue that to be honest I have never needed a requirement for in ...
0
votes
1answer
15 views

how to change “posted by” words

How do I change the words "posted by" and "on" that show on top of each WP post, to my own language? For example I want to change this: Posted by محمد on 6 نوفمبر 2018, 12:22 م to: كتبه محمد في 6 ...
0
votes
0answers
14 views

Set custom form limit-entries Gravity Forms

i am trying to limit a Gravity Form in my WordPress project by a custom field. This field, which is an ACF field like others on the same page, only calls a number. I am trying to overwrite the field "...
0
votes
0answers
9 views

How to add on post “read more” (not on home page)

I have searched for a trick to display the option "Read more" in all the articles of the wordpress blog. And that I would like it to be automatically from a number of words. I do not speak articles on ...
-1
votes
0answers
13 views

Getting page content from a function?

How can I generate a "custom" page which gets its content from a function? I see there are two functions, add_menu_page and add_submenu_page, but these only work for the admin section. I cant find any ...
0
votes
0answers
8 views

Input Mask on Standard Registration/login page

I'm looking to implement an input mask onto the standard wp-login.php file and not onto a custom Wordpress form. This is so that users can only register using a formatted username i.e. r7849304 or ...
0
votes
1answer
23 views

Co-Authors Plus: How do I get all authors with a query?

I've recently installed the Co-Authors Plus plugin and am trying to get all the authors from a post within a post loop. However for some reason when I use get_queried_object(), there is only one ...
1
vote
1answer
37 views

Shortcode returns escaped HTML tags

To put things in context, I'm using Gantry on WordPress, which is bundled with Timber and Twig. I have this code, basic, make-your-text-bold shortcode // Add Shortcode function bold_text_shortcode( $...
0
votes
0answers
24 views

Problem with google recapcha and wordpress ajax login

I'm using google recapcha for validate my ajax login form in wordpress, everything is ok and ajax form worked very well! but when i add recapcha and send it value to validate i give error 400 bad ...
-1
votes
0answers
7 views

Limit search to category, post titles, metas, post types and tags only

Can i limit the search to post titles, tags, custom post types field and category only without plugin, if yes can i get a code to put in function.php Thanks for your help, if any?
2
votes
2answers
19 views

Display only custom post type count for current author on the “At a Glance” dashboard widget

I am using this code to display all custom post types along with their count on the "At a Glance" dashboard widget: add_action( 'dashboard_glance_items', 'cpad_at_glance_content_table_end' ); ...
0
votes
0answers
22 views

Add class to body after page has loaded

I would like to add a Class called "snap" to the <body> tag only on two templates (the front page and on my single Custom Post Type page 'projects'). To do that I don't have any problem. But I ...
0
votes
1answer
11 views

Load custom post type with ID in a shortcode

I develop a theme for the first time. I created a custom post type for banners/call to actions that I want to include in different posts with a shortcode. The shortcode should look like [banner id=123]...
0
votes
0answers
9 views

WooCommerce Custom Pagination Layout

as currently my site product pagination is display as PREVPAGE 1 2 3 .. 15 NEXTPAGE May I know how I can make it as FIRSTPAGE PREVPAGE 12345 NEXTPAGE LASTPAGE ? I'm trying to achieve it same as https:...
0
votes
1answer
12 views

Add_filter when value is no variable?

Let's say I have an function like: function cc_get_content_preview() { return apply_filters( 'cc_get_content_preview', get_the_excerpt(), 55 ); } Here get_the_excerpt() is the $value that I can ...
0
votes
1answer
20 views

Template Loop - add switch case php

My plugin template is currently as follows: if ( $query->have_posts() ) { ?> <ul id="list-con"> <?php while ($query->have_posts()) { $query->the_post();...
0
votes
1answer
18 views

Add parent menu item in sub-menu in custom nav_walker

Currently I'm working on a project where we need to append the parent title as first item in the submenu for a mobile menu. What I try to achieve is this: <ul class="menu"> <li> ...
0
votes
0answers
8 views

How we can show HomePage ad to Category pages and Search Pages

I have Created a Plugin by getting code from How to put a banner ad between post 1 and post 2 on homepage only But this Plugin is working only on HomePage, But i want to show ads on Category (domain/...
0
votes
0answers
9 views

How can I preserve URL parameters across pages when visitors arrive via an email campaign?

I'm fairly inexperienced with Java and web development in general beyond Wordpress Widgets so apologies in advance if it shows. When I send out an email blast I stick two parameters to the end of ...
0
votes
1answer
6 views

Change default color scheme in twentyfifteen child theme?

I read the previous ask about this. And tried renaming my scheme to "default" and it didn't work. I am implementing the child theme on 50+ blogs on a network and I would like to just click "Activate" ...
0
votes
1answer
17 views

Remove Custom Divs from AMP pages

I am using Automattic's plugin to implement AMP on my website. Currently, to make my videos responsive, I wrap YouTube videos around a custom div. So, a YouTube video on my website looks like this:- &...
0
votes
0answers
8 views

Redirect Search link to specific Category search

I simply want to redirect all search link on my post to custom category search. E.g I have a category named WordPress, and content of the posts on that category already contains links to search ...
0
votes
0answers
11 views

Search by Category With Custom Search

Please help me out, Is there any way I can make a custom wp search to work on category? already I have a custom search with /search/ permalink. But it does not work on category it only works on ...
0
votes
0answers
11 views

Show different forms depending on selected language

I'm using a theme that uses a booking form on the product page. It's an event booking theme. I wanted for the booking form to only show up on specific products. On all other products, I wanted a ...
0
votes
0answers
12 views

How to create account-switching function for Wordpress front-end users

I am working on a Wordpress website where we have built a web-app of sorts that gives users a profile and helps them connect with others in their specific industry. Users can sign up for a profile as ...
0
votes
0answers
37 views

Apply fix to a function

I need to apply this fix: protected function buildQuery($mode = 'POST') { … if ($mode == 'POST') { /* POST body has to be an array and NOT a queryString */ //$args['body'] = http_build_query($request)...
2
votes
1answer
41 views

Best practice custom function, where to echo the variables?

I have a custom function to query some posts. I was wondering if it is okay to echo variables within the loop of the function, since normally I would echo a variable at the end of the function. If so, ...
0
votes
1answer
19 views

Return function results within shortcode

I'm trying to write reusable functions in a plugin and call the functions within a shortcode. But, I can't get any output. Why don't either of these methods work? <?php function say_sup(){...
0
votes
0answers
17 views

Is there any function to get form submit value with default value?

Is there any Wordpress function to replace this code? <?php $page = isset($_POST['page']) ? $_POST['page'] : 1; I would like to replace isset($_POST['page']) ? $_POST['page'] : 1; to a easy ...
0
votes
0answers
17 views

Wordpress Toggle Menu has stopped working

I am using the twentyfifteen theme on my wordpress site. When you access the site on mobile or resize on your browser so that the page height > width, a hamburger icon appears on the upper right. I ...
0
votes
1answer
15 views

Restrict access if logged out except for homepage

I want to retrict access to my whole wordpress except for the homepage and one other page. The problem I found is that the other page is accessible but not the homepage. My wordpress installation is ...
0
votes
1answer
25 views

Why is wp_list_authors not picking up Authors from CPT's?

Why is wp_list_authors not picking up Authors from CPT's when I have the supports option enabled? From what I have read elsewhere it looks like I have everything covered but the authors of CPT's ...
0
votes
0answers
12 views

Error HTTP with Imagick on functions.php

When I upload jpg/png or mp3 files WordPress get ERROR HTTP. I have the following code on my functions.php: function register_watermarked_size() { add_image_size( 'watermarked', 550, 550, true ); //...
0
votes
0answers
11 views

Add a CDN with no plugin. Fix

Im looking to implement a CDN without the use of any plugin. I came across a website that has a code to add to functions.php that works but it only grabs some files from my uploads folder not all, ...
-1
votes
0answers
6 views

Is it possible to rearrange the placement of the Post Author dropdown?

Is it possible to rearrange the placement of the Post Author dropdown? Currently it only appears at the bottom of the page and I would like it to be the first field that is displayed (above the ...
0
votes
1answer
23 views

Using custom fields for image alt and title

I've Add a custom field to my products editing page with ACF. Custom field name is my_seo_title ; Each product has a unique SEO Title. How can I use this field as an alt text and title for images in ...
0
votes
0answers
11 views

pass first tag and first category variables into html string

hope you can help. I'm trying to get first 'tag' and 'category' variables to be passed in html string, but it's not working. Any ideas why this code below isn't working. Probably something glaringly ...
0
votes
0answers
22 views

Add meta data in head from theme

I want to add a meta data in the head of my website. I have a post type with custom template : single-custom.php In this template, I want to add this meta : <meta name="robots" content="noindex"&...
0
votes
1answer
25 views

Add attribute only to first image of every post via functions.php

I would like to use a simple function in order to add a specific attribute (lets call it “example”) to the first image of every blog post, so that I don't have to do it manually in thousands of posts. ...
1
vote
1answer
22 views

Shortcode created to check language not works

i need to create a shortcode to display a different Div depending on WP current language only when users are logout. The shortcode is this one: function coupon_box() { $user = is_user_logged_in() ; ...
0
votes
3answers
27 views

Get user custom field value on function.php

I created a function in function.php which send an email with user information at registration. I succeed to get the ID but I can't get custom fields... I only can get these ones : - ID - ...
0
votes
0answers
26 views

Why is the term of my current page not returning a slug?

Why is the term of my current page (custom taxonomy) not returning a slug? I have managed to get the following returned in my URL: 0, Array, '/{empty space}/ I am trying to pass the custom taxonomy ...
0
votes
0answers
10 views

How to style Image and Gallery Output for AMP?

So, I am trying to create a custom AMP template for my website without a plugin. Here's where the problem is. I am using a single-amp.php to redirect /amp posts to the AMP template. I have then used a ...
0
votes
0answers
9 views

Assign multiple user created menus to one theme location

I know what I am asking is probably out of the scope of Wordpress's ability but anyway. My issue is that I need to assign multiple menus to a single theme location (the dynamic location), I have set ...
0
votes
1answer
17 views

Change Search display for Custom Post Type

I want the search to not search for custom post type "mitgliederbereich" when on other pages, and when you are on the "mitgliederbereich" page, that only "mitgliederbereich" posts should appear in ...