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)

4
votes
0answers
102 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: ...
3
votes
0answers
38 views

Efficient coding: how to keep track of function stack?

I've written a plugin that calculates how much server time is required for each function in a theme or plugin. The idea is it will encourage developers to write efficient and green code. If you want ...
2
votes
0answers
43 views

Download external images with function

Actually, i display images on my site from other sites. Url is on a custom field name "couv" I'd like to download theses pictures on my site and create a new custom field with the new value "couv2" I ...
2
votes
0answers
453 views

Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information ...
2
votes
0answers
134 views

Prevent “main” WPMU site_url() being returned in functions

I've noticed that in a WordPress MU install with domain mapping enabled, some functions return URIs that don't use the current WPMU site's primary domain name which possibly means they are "WPMU ...
1
vote
0answers
18 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 ...
1
vote
0answers
25 views

Use author author display name in permalink structure for pages and posts

I need to add the author name as a subdirectory prefix for all user's posts and pages. For example: example.com/johndoe/ //The author page for John Doe example.com/johndoe/category/test-post/ //Test ...
1
vote
0answers
43 views

Multisite Ajax serialize return error [object Object]

Working on custom WP theme, i'd like to add some "add_testimony" linked to custom post. Form is real simple, here it is : <!-- Add testimonial --> <div class="col-md-12"> ...
1
vote
0answers
18 views

Create a Button alongside add to cart

i want to create a button alongwith add to cart that will perform a specific function. please tell me how to do this.Also can you tell me the css of this button so that the button looks exactly like ...
1
vote
0answers
25 views

Adding a widget function into the php theme file

I am using the following plugin - widget No Cache AJAX Widgets to display on the sidebar a feed of rss news that is created dynamically and bypassing the cache function. In updating the site we wish ...
1
vote
0answers
46 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
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: ...
1
vote
0answers
28 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
0answers
34 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 ...
1
vote
0answers
43 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 ...
1
vote
0answers
37 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 ...
1
vote
0answers
15 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
0answers
17 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
0answers
37 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 ...
1
vote
0answers
27 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, ...
1
vote
0answers
33 views

Can't find infinite loop cause

I am working on the below function which will eventually create a set of posts based on meta data entered into a "parent" post. I'm running into an infinite loop when hitting the save button, which I ...
1
vote
0answers
48 views

bulk change of image setting “link to” to “link to: image url ”

i want every image present on my wordpress site with setting "link to: none" or "link to: post url" became in "link to :image url" ho make this for old post and for new post ? i tried this code in ...
1
vote
0answers
51 views

Displaying Login form with Shortcode

So I am trying to display a working version of the default wordpress login form on one of my pages. There is code in the functions.php file that creates the shortcode and as far as I know it works ...
1
vote
0answers
22 views

Categories as main menu items and subcategories as nested lists

I am new to WordPress and am trying to make my website. Would it be possible to list categories and subcategories as a nested list with links in the main navigation menu. What am i trying to achieve ...
1
vote
0answers
80 views

ajax category filter

I know this is a big ask for you guys, but i can't seem to figure this out. I found this page : http://www.bobz.co/ajax-filter-posts-tag/#comment-28112 it shows how to make a dynamic filter for post ...
1
vote
0answers
77 views

Change logo based on incoming domain

The agency I work for are trying to get a client's logo to change based upon the incoming URL. Now, we have 4 different URLs, therefore 4 different logos. Currently, we are using an if/else ...
1
vote
0answers
27 views

Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host

OK, firstly we have done this before using Magento and it worked well, but with WordPress? Well, here is the problem and the plan... The Problem For a few reasons we wish to use a 3rd Party host for ...
1
vote
0answers
47 views

Default Custom Field Value Automatically Update

I have created a hidden custom field with a php function as its value. Like so -- $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control ...
1
vote
0answers
25 views

Rewrite woocommerce categories widget urls

I am attempting to rewrite the list of categories url in woocommerce categories widget printed to the page. Not sure if I am adding this to the correct hook, or where I went wrong. function ...
1
vote
0answers
72 views

WooCommerce email shipping text value

I'm attempting to use the 'woocommerce_order_shipping_to_display' filter to show 'Free' in the WooCommerce email table when no shipping charges will be incurred. In the image, I'm trying to get 'Flat ...
1
vote
0answers
81 views

Customize WordPress Media Manager - Media Window

Im trying to customize the wordpress media manager "add media" window to get it as simple as possible to use. So i want to disable/ hide the following fields/ functions because i dont need some or ...
1
vote
0answers
48 views

Attempt to change jQuery version caused White Screen of Death

I'm working on a client's WP installation, and I'm attempting to replace the default jQuery library included with WordPress to a newer version. I inserted the following script into the site's ...
1
vote
0answers
39 views

Adding a colorbutton in tinymce dialog with current api

I'm trying to add a colorbutton in a tinymce dialog box, which i was able to do with the help of using this stackoverflow question here: ...
1
vote
0answers
223 views

check if author has published posts in custom post type, then send mail

I have a site where people can submit drafts to a custom post type from the frontend. Once a user submits the form, a new WP user is created. If the user is logged in the submitted user e-mail ...
1
vote
0answers
30 views

How to change permalink to include custom post type

Is there a way to add custom post type to permalinks with a plugin or otherwise? This is what I am trying to accomplish: mysite.com/projects/food/burgerking mysite.com/projects/wine/cherryvineyard ...
1
vote
0answers
119 views

mysql_real_escape_string() vs. esc_sql() in WordPress

Does mysql_real_escape_string() and esc_sql() in WordPress both do the same thing? I tried the following: $fetch_row='<p>And again for single posts</p>' echo mysql_real_escape_string( ...
1
vote
0answers
173 views

Pagination in relation to archive.php

A small problem here, I just don't know how to change this because I'm a self taught newbie. I made a child-theme from the simone-theme with a static front-page. To it I have the archive.php as the ...
1
vote
0answers
556 views

Create new user without password

For a specific use case, I need to add users only by username and email without having to input a password for them. Right now if i try to leave the password field empty, it displays an error. How ...
1
vote
0answers
211 views

Can't generate thumbnail images

Having a very strange problem with this site I recently took over hosted on RackSpace. Seems whenever i upload a new image, it doesn't generate different sizes and I'm trying to get it where it will ...
1
vote
0answers
102 views

Override a theme function in a child theme?

Most if not all of the answers to this question are pretty old, or are for edge cases. I have a child theme for a commercial theme ("Total"). The parent theme's functions.php loads functions from ...
1
vote
0answers
434 views

Overwrite Parent Theme add_image_size in Child Theme

I'm using a child theme of a parent theme. Now on my parent theme, theveloper adds some custom image sizes like this - if ( function_exists( 'add_image_size' ) ) { add_image_size( ...
1
vote
0answers
398 views

Create post using Ajax

I want to create post using Ajax . I had followed the process from Insert Post using Ajax But I couldn't make it work. Here is what I did. Please see what I did wrong as I am just a learner. EDIT ...
1
vote
0answers
154 views

Call wordpress function outside wordpress

I am writing an script to get wordpress posts and user data outside wordpress files and folder, this script run by side of wordpress installation but will fetch data from wordpress as explained below. ...
1
vote
0answers
47 views

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
1
vote
0answers
98 views

How to remove custom post type and add category and post name

I have a custom post type called listing and taxonomy for this listing is called listing_cat. At the moment my wordpress permalinks appear in this format ...
1
vote
0answers
173 views

Wordpress PHP Conflicting User Sessions

I'm using the following function to programmatically login users via the frontend: function auto_login() { $username = $_POST['user']; if ( !is_user_logged_in() ) { $user = ...
1
vote
0answers
125 views

Move Custom Fields on General Settings Page to New Location

I've created some custom fields on the General Settings page after studying up on this post: Add multiple custom fields to the general settings page. I'd really like to move them to their own ...
1
vote
0answers
1k views

wp-comments-post.php file returns a blank page

When i post a reply to my blog, it's return a blank page to me. It seems that happens because of this code in wp-comments-post.php if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { header('Allow: ...
1
vote
0answers
62 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...