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
2answers
554 views

AJAX values converted to PHP Variables?

I just started playing with Wordpress and I have a question about the AJAX side of things. I think that I understand how the AJAX front-end to server side processing, back to font-end works. But, I ...
2
votes
1answer
6k views

Using wp_get_nav_menu_items() to list children of children pages

I'm working with a Genesis Based Theme and I'd like build a Page/ Child Page menu structure. That part I can do with the help of some code produced by Bill Erickson. Essentially what I'm trying to do ...
2
votes
1answer
46 views

Can I disable this core query?

When a user creates/updates a post within the admin, it takes between 15 and 30 seconds for that operation to complete. The culprit appears to be this slow query: SELECT ID FROM wp_posts WHERE ...
1
vote
1answer
961 views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
1answer
17 views

Multisite Admin Roles

I have a multisite with the following lines of code in my functions.php file: add_role('test', 'Test Priv', array( 'activate_plugins' => true, 'delete_others_pages' => true, ...
0
votes
1answer
454 views

function triggered by “manage_users_custom_column” filter not working

I am trying to add a custom column un users.php but it stays empty. I have successfully added a column to the users admin page with this code in my theme's functions.php file: function ...
0
votes
1answer
26 views

How to remove Customize from admin menu bar after WP 4.3

WordPress 4.3 brought more updates to the customizer. It also added a new option at the top admin menu bar that says 'Cusomize' and has a paintbrush. How can I disable this menu from showing up? We ...
0
votes
1answer
27 views

Showing content from one page on another

There are many posts that seem to strike around this area, but I'm more and more confused by each one I read. I have a page that shows the "Terms of Service" (id = 1086). I would like to display the ...
0
votes
1answer
9 views

WordPress not showing pagination links

In my WordPress Index.html I am pulling out the 3 latest posts by using <?php query_posts('posts_per_page=3') ?> <?php while(have_posts()) : the_post(); ?> //rest of the post related ...
0
votes
1answer
24 views

How I can add div to menu?

I have div structure <div class = 'main-menu'> <ul class = 'menu'> <li class = 'item1'></li> <li class = 'item2'></li> </ul> </div> But I want ...
0
votes
2answers
629 views

How to add icon over specific thumb

I wanted to do the following, and I know its possible, but I don't know how. I'm looking at in_category, but it doesn't make to much sense. Basically what I want to do, for an example on my homepage, ...
4
votes
4answers
565 views

Should I write a PHP function in home.php?

I am trying to learn WP Theme development. And as I have understod all "wp core" functions should be placed inside functions.php. But what about custom functions? Lets say I would need a simple ...
0
votes
2answers
392 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( ...
1
vote
1answer
20 views

Define Function in functions.php or plugin and call in theme loop

I need to define a function in functions.php or a plugin and be able to call it inside the theme's loop & outside. Example; I have a $product_price = get_post_meta(get_the_ID(), 'product-price', ...
0
votes
0answers
25 views

Rewrite rules lead to blank page

Using a child theme, with custom post type article, trying to call a file from functions folder inside the child theme main folder (child-theme/functions), using this code in the child theme ...
0
votes
1answer
382 views

call wp_insert_user in custom class doesnt work

im creating a custom class to manage users in wordpress and chamilo but this is not the point. Class looks like this: class Platform { private $security_key = '..'; private $secret_key; ...
1
vote
2answers
598 views

Update user meta of author when post content is viewed

I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it ...
0
votes
0answers
9 views

Get stock from another store for a WooCommerce store [on hold]

I want a help! I am reseller of other stores, and as the store grows it becomes hard to manually update inventory. I have a custom field _url_font that I fill with product source address. I wanted ...
0
votes
1answer
451 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only ...
-1
votes
0answers
26 views

How to add repeater field to option page?

I've created an options page for blog. In this options page, I can save some details about the website. using this code: add_action( 'admin_menu', 'site_add_admin_menu' ); function ...
0
votes
2answers
632 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
2
votes
3answers
293 views

Implementing DNS Prefetching with WordPress

I'm not sure whether my question sounds promising or not but what I'm going to ask is very much relevant. So please read the full question before down voting or flag. I'm trying to implement DNS ...
0
votes
1answer
600 views

Session is not starting

I've read the usage of session() in WordPress from here and here. And I placed the following code into the very starting of my functions.php: /** * ENABLING SESSION TO THE SITE * Thanks: Shazzad ...
1
vote
1answer
741 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
0
votes
0answers
19 views

How to wp_enqueue_script with html?

I want to wp_enqueue_script multiple javascript with html and css. I place the html code in a page, but it's not working on my side. Only plain text is displayed. Here's the link: ...
0
votes
2answers
218 views

Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS

I've been having trouble Automatically Compiling my .scss files into my main WordPress style.css file. I'm using Leafo's SCSSPHP script and trying to achieve a few things. i'm using Kirki ...
1
vote
1answer
33 views

How to override a plugin function wrapped in a class?

The class is from someone else's WP plugin and I want to adapt one of the functions from that class (there are more functions). The (edited) original code: class some_class { private function ...
1
vote
1answer
15 views

Where can i find wordpress auto update code flows?

I want to see how WordPress auto update works in code . which WordPress file or function performs auto core update? I have read http://halfelf.org/2011/how-the-wordpress-upgrade-works/ I have ...
0
votes
1answer
20 views

Automatically add tag if a checkbox is checked

I'm looking for a simple function to automatically add a specific tag to a post if a checkbox is checked. For example: When creating a post there is a checkbox that says: "Add example tag to post" ...
0
votes
0answers
7 views

How to override class of theme in child theme aka get google latin ext fonts

I have bougth a premium theme at ThemeForest but nobody has answered to my question - they are using Google fonts in the theme, but unfortunately, without latin extended characters and I have no clue ...
0
votes
0answers
9 views

How do you get all the posts and generate a table automatically in page?

I am trying to make a page with all the interesting posts(tagged with "interesting") and make a searchable table using TablePress. First of all, is this possible? If so, 1) what is a function in ...
0
votes
1answer
20 views

How to style injected code in header section?

Trying to add custom code to header section <head>..</head>of the blog by adding this code to child-theme functions.php // Add scripts to wp_head() function child_theme_head_script() { ...
0
votes
1answer
137 views

Show custom default avatar instead of gravatar

I'm using this custom function to get the default avatar from my server instead of gravatar: if(!function_exists('custom_avatar')){ function custom_avatar($avatar_defaults){ ...
0
votes
0answers
5 views

Convert NOBLOGREDIRECT to use 301 instead of 302

Does anyone knows any process to convert the NOBLOGREDIRECT 302 conversion to 301 for WP MU sites? When you define the NOBLOGREDIRECT value to some url, it uses 302 to redirect to that url. I want it ...
0
votes
1answer
19 views

Remove links from the_content when using filters wp_trim_excerpt

I'm using wp_trim_excerpt which is working perfectly but I want to strip the links contained in the the_excerpt (using get_the_content), I've looked online and tried many solutions to get the thing to ...
3
votes
2answers
3k views

What is the correct MIME type for PSD (Photoshop)

I am trying to create an upload area (frontend) for word press users on a site. I've got a lot of types opened up through some function calls, but unable to correctly get PSD support. I'm seeing a lot ...
1
vote
1answer
1k views

How to set the jpg image compression for specific thumbnail sizes?

This question was asked on Set JPEG compression for specific custom image sizes and answered very nicely by Ahmad M I'd of course comment to that thread but I don't have 50 point reputation... The ...
0
votes
1answer
650 views

How to echo Widget Title in Custom Frontend-Template Box

I've created a custom Widget with the help of following code: // Creating the widget class wpb_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of ...
0
votes
2answers
37 views

Database SQL Error, Should Work

I'm trying to get my posts to order by radius, and so far i'm struggling, I've been using the following tut by Steve MArks, http://biostall.com/performing-a-radial-search-with-wp_query-in-wordpress ...
0
votes
1answer
25 views

How to style options page in dashboard?

working with a child-theme, adding a custom options page to dashboard in which admin can save details about the site. Using this code in the child-theme functions.php to create the options page: ...
1
vote
1answer
28 views

creating shortcode to pull json array

Frankly - this may be a duplicate of another question I have out there. Sorry if it is. I'm learning this site and PHP/Wordpress development. I have partnerships with local sites that use JSON and ...
0
votes
1answer
38 views

Database Query not working

I've been following a tutorial by Steve Marks which goes throught adding information from posts to a new Database Table as well as the usual postmeta one. However no matter what I try, It will not ...
0
votes
0answers
25 views

Is there a hack for using is_page() within the function.php file?

I've created a function in my functions.php that's called when the submit_form event is fired on the front-end. Here is the code: add_action( "wp_ajax_nopriv_submit_form", "submit_my_form" ); ...
1
vote
2answers
29 views

Access Plugin data from Functions.php

I'm trying to insert data from a wordpress post into a new table database table rather than WP_postmeta. My function is working, It'll insert the $postid no problem at all. The issues I'm having is I ...
0
votes
0answers
20 views

Problem creating menu shortcodes

I'm trying to setup three shortcodes, each to display its own unique menu block. Just two are shown in the code below because I ran into an issue. The problem I am having is that both [footera] and ...
0
votes
1answer
2k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
1answer
21 views

How to use parent theme functions in child theme functions.php file?

Parent theme required a foo.php file, and inside that file is a baz() function. I want to use that baz() function in functions.php of the child theme without recall foo.php file again. Are there any ...
0
votes
0answers
13 views

Empty categories not showing up with custom function

I'm working on a WordPress based website, and I have three levels of categories. Something like: Category 1 Child 1-1 Grandchild 1-1 Grandchild 1-2 Grandchild 1-3 Child 1-2 ...
0
votes
0answers
14 views

Manipulating DevBuddy Twitter plugin

I'd like to manipulate the DevBuddy Twitter plugin, to change the order of divs inside .tweet_content. I would like .tweet_media to come before .tweet_profile_img for the sake of my layout. I had ...
1
vote
1answer
598 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...