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.

learn more… | top users | synonyms (2)

0
votes
1answer
1k views

Creating wordpress user registration form

I am having a form page called Test Form with this form : <div id="container"> <form action="wp-content/themes/max-magazine/TestForm.php" method="post" name="myForm"> User <input ...
1
vote
1answer
27 views

Custom Shortcode, functions PHP WP_Query loop

I have the following code in my functions.php file:- function featured_properties_func( $atts ) { $args = array( 'posts_per_page'=> -1, 'post_type' => 'properties', ...
1
vote
0answers
15 views

Update user profile information from functions.php

I have the following function in my functions.php file:- function apply_for_job() { $job_id = $_GET['job_id']; $user_id = get_current_user_id(); $prev_value = get_field('applied_jobs'); ...
1
vote
0answers
12 views

Homepage's content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?

I have a custom field in my home page called "Featured posts". There are two fields: title and post. The post field returns post_object with post_type as posts. In my functions.php I have added the ...
1
vote
4answers
5k views

redirect wp-login.php to another page

I would like to redirect this page wp-login.php to /login page. So when a user clicks on a link like this <a href="/wp-login.php">login</a>, wordpress will redirect him to /register . I ...
3
votes
1answer
62 views

Displaying post per day

Currently I have the code displayed below. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <a ...
1
vote
0answers
28 views

add_action shortcut?

I think in PHP 5.4 or above (don't remember the exact version), instead of writing: function some_function() { } add_action( 'init', 'some_function' ); One can pass an anonymous function: ...
2
votes
1answer
28 views

how to change link of some wordpress pages

I've made templates for the pages of my wordpress site such as: singup,signin,suggestions. Default wordpress pages link is as follows: doamin.com/signup/ or doamin.com/signin/ or ...
0
votes
1answer
21 views

Limit dimensions of “Full” size images

Is there a way to limit the dimensions of the full size uploaded image (made normally through the Media library)? I have clients that upload huge images files with resolutions sometimes greater than ...
1
vote
1answer
18 views

Missing Argument

I have the following code in my functions.php to show a lightbox on the Simple Paypal Shopping Cart Plugin function make_wpspsc_thumbs_lightbox_previews( $thumbnail, $atts ) { // Code Credit: ...
1
vote
0answers
10 views

Get First Child Page ID or Permalink in WordPress Admin

I have a navigation set where the content doesn't exist on the parent page, but rather on a page called Overview which is the first child of the parent. eg: About is the first level page, but when ...
1
vote
1answer
31 views

Override the function twentytwelve_scripts_styles in a child theme

I want to overide the function which enqueues scripts and styles in the theme Twenty Twelve using its child functions.php. I followed this guide but can't get it to work. Can someone suggest a ...
0
votes
0answers
11 views

Multiple relationships pods issue

I'm new at using Pods, which I find very practical. I'm experiencing some issues though; I'd like to create a model like the following-one : Entity type 1 |->sub-entity type a, refers to a specific ...
1
vote
0answers
24 views

Dynamically change feature image in customiser

For this client's Website I am making on their homepage there is a section called featured products with images showing off the product. Currently I have to update these images manually through my ...
2
votes
1answer
436 views

Child theme - Overriding 'require_once' in functions.php

I am attempting to modify a wordpress theme with a child theme. My parent theme has the following function in its functions.php: require_once(get_template_directory() . "/includes/theme-styles.php"); ...
0
votes
1answer
75 views

Using Wp_Query, Json to add Highcharts series data

I just added a custom Highchart to my wordpress single custom archive page. http://propertywise.malisa.agency/en/district/khlong-toei-2/ Using the following function call from within the Highcharts ...
1
vote
0answers
18 views

WordPress Quick Question . How to Get Parent Link in Submenu in My Code

I'm creating a menu walker from foundation 6 but problem is parent link is not click able, so solution might be that if we can get parent link in submenu but have some problem because I'm don't know ...
0
votes
1answer
680 views

How to add nav menu items to a specific position within a menu

I'm adding login/logout links to a nav menu using the following code: function rp_add_login_logout_links( $items, $args ) { $link = wp_loginout( get_permalink( get_option( ...
3
votes
1answer
7k views

Add container to nav_menu sub menu

Is there a way I can wrap a div around wp_nav_menu's ul.sub-menu So for example the markup would go from <ul class="menu"> <li><a href="/">Item 1</a></li> ...
1
vote
0answers
36 views

Get the date of the className or classID

Is it possible to get the date of the class name or class ID? I just used the following to get the date of the post, but there are image galleries and each image has a different upload date: echo ...
2
votes
3answers
987 views

How to display post tags

I'm converting an HTML template into a wordpress theme and I'm having some trouble displaying the post tags within the functions.php file. What I would like to do is add the following code into the ...
0
votes
0answers
6 views

Cachebust child theme stylesheet queston

I am using the below to cachebust my child theme stylesheet with a version number. I noticed that Wordpress continues to try and load my original child stylesheet "style.css" in the head even though ...
1
vote
1answer
103 views

How to display custom field in woocommerce orders in admin panel?

currently i add a custom billing field in woocommerce by function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_phone_new'] = array( 'label' => ...
1
vote
1answer
31 views

Footer disappears when using the_content ( )

I have an issue when using the_content() -- the footer of the page disappears and no errors are displayed. When I change the_content() to get_the_content() and echo this results then it works fine. ...
1
vote
1answer
49 views

Child theme functions.php not executing

I have the following in a child theme's functions.php file: <?php function theme_child_add_scripts() { wp_register_script( 'script', get_stylesheet_directory_uri() . ...
1
vote
0answers
13 views

How to assign a customer to an order?

I have a problem assigning a customer to an order using a php script. Is it even possible? I know, that it is possible to get the customer ID back from the order, but I can't find a way, how to set ...
1
vote
5answers
14k views

Include PHP file in Content using [shortcode]

Here is what I have I am not having any lucking finding how to simply include a file in the content editor using a shortcode. For Example if I wanted to include form.php inside my Contact Page how ...
3
votes
1answer
107 views

WP 4.4. responsive loads normal image after loading the responsive image

I have the 2 new added sized that I am testing: // testing add_image_size('new-small', 500, false); add_image_size('medium-large', 768, false); // just added today for devices support image ...
1
vote
1answer
19 views

Having issues with a foreach inside of a shortcode with ACF gallery

Normally I would just put this type of content in a template, but the way I'm pulling in the content is a bit different. I made a shortcode which I've been having issues with. It's using Foundation ...
0
votes
2answers
547 views

Custom registration form in shortcode getting internal server error 500

I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below /* Custom shortcode */ function ...
1
vote
0answers
15 views

Full page template function

I would like to be able to create page templates that all look almost the same, and have a template I would like to use. I would only like to change certain fields for the page, for example: header ...
1
vote
1answer
17 views

Get page id or status by private pages?

How can I get post id or status by private pages if user is not logged in? This don't works: get_the_ID() get_post_status ( $ID ) I found some usefull informatins here but is not enough to detect ...
2
votes
0answers
33 views

How to override a function when isn't at functions.php

I am trying to override a function for a theme in the child-theme but I can't get it to work. At functions.php on the theme I can see this require_once line: ...
1
vote
1answer
20 views

Set quantity of woocommerce product on page visit

I'm trying to set the quantity of a product on visiting a page. If the product isn't in the basket, the code works fine and adds the correct quantity. However, if I have anything in the basket and ...
2
votes
1answer
30 views

Limit filter upgrader_post_install to a single plugin

I am using the following filter to run a function that generates a CSS file after a plugin gets updated. Currently the CSS gets generated when any plugin gets updated. Is there a simple way to limit ...
1
vote
0answers
23 views

Redirect from “private” page and functions.php which tag add to add_action()?

If someone try to open a private page as guest user he says only "Oops! That page can’t be found.", I want to redirect it to a exact page, I try to do it in functions.php but I'm confused what to add ...
4
votes
10answers
3k views

disable WP automatically inserted line breaks after an image

I've set medium sized images to a custom size which should allow for both of the images to align horizontally within the post. (The full post width is 880px, medium images are set to 413px.) My ...
1
vote
1answer
30 views

function to erase swear words

Does anyone use a function that will just not print swear words? We don't have any, and we edit for them, but in giving more writers more publishing privileges, it could lead to a situation with swear ...
1
vote
0answers
29 views

How to pass “get_the_terms_list” as shortcode to Visual Composer Grid Builder

I am trying to create a shortcode that returns the term list inside of Visual Composer's Grid Builder. I have read the docs here. My code is as follows: add_filter( 'vc_grid_item_shortcodes', ...
1
vote
1answer
1k views

Using PHP to toggle stylesheet and header image, set in cookie

I haven't done a lot of work with cookies or Wordpress before so I think I've been a bit over-optimistic in my quest :p I have created two themes for my site, night and day. I would like the user to ...
1
vote
1answer
38 views

My new button is in the wrong place

Initially, I was trying to have the "Add to Cart" button change to "Make an Inquiry" based on the condition of availability and whether there was a price inputted, or not. I kind of got the ...
0
votes
2answers
513 views

Passing postid of Testimonial Custom Post in Shortcode Parameter

I am trying to create Testimonial custom post and display using shortcode function create_post_type() { register_post_type( 'testimonials',//new post type array( ...
0
votes
1answer
566 views

How can I add a Custom Button to Add or Edit post / page next to Add Media?

I'm trying to add a custom button nearby the Add media on the wordpress Add and Edit Post/Page. How can I do that? Thank you very much for your help!
1
vote
2answers
4k views

Getting the post_id in wp_ajax function

I wrote a custom AJAX function in which I have assigned a post type to be a child of another post type. In one function I am looping through those child posts, and I want to update the database to ...
2
votes
1answer
30 views

How to Add a Random Custom Gravatar in the WordPress Comments?

I have a client that has 5 different gravatar images, and would like them to be randomly used as the thumbnail for people's comments that have no Gravatar. I know how to change the Gravatar to a ...
0
votes
1answer
415 views

How to add 'data-caption' inside an anchor tag

bellow is custom gallery code. function custom_gallery_shortcode( $attr = array(), $content = '' ) { $attr['itemtag'] = "li"; $attr['icontag'] = ""; ...
6
votes
1answer
130 views

Does hooking into the same action multiple times drain memory?

Currently I have three functions that run on pre_get_posts. I call them like this: add_action( 'pre_get_posts', 'private_groups' ); add_action( 'pre_get_posts', 'search_results' ); add_action( ...
1
vote
0answers
19 views

meta_query not working as expected

I have 3 posts that each have two meta values. The first meta value is one that they all share (ac_parent_event). The second is one that is unique to that post (ac_thischild_date). For this function, ...
0
votes
1answer
740 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
-1
votes
2answers
30 views

load_plugin_textdomain error

I receive this error while debug mode is enabled: Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in ...