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
194 views

Meta box not appearing in my custom post type

I followed this tutorial on how to create a metabox on a custom post type I made and, at the time, it worked perfectly. the fist time worked like a charm. This time though, In a very similar ...
0
votes
3answers
60 views

Add a variable in functions.php and call it in single.php

I am new to PHP and am building a WordPress theme. I would like to add a variable in the functions.php and use it in single.php as an if statement. At present, my single.php has the following code - ...
0
votes
1answer
75 views

register_activation_hook for multiple functions

I have created a plugin where I want to call two different functions on activation. Is there a best way to do this? Should I use register_activation_hook twice? As in: register_activation_hook( ...
1
vote
1answer
86 views

I have functions in my wordpress plugin. How do I get them to work for me?

This code is edited but comes from this site. If I want to use a remote website to insert data using the last function from a URL link how do I do that? My code is: <?php /** * Plugin Name: ...
0
votes
0answers
22 views

Creating new blog on multisite programatically without hacks?

I'm attempting to create a new blog ( on localhost testing ) and I can't seem to find a straightforward way to do it. It appears this is not fully supported yet, but I want to make sure. This is ...
2
votes
1answer
332 views

How do I add a custom post type to the Featured Content in twenty fourteen theme?

This wpmudev post sums up my feeling exactly about twenty fourteen: Featured Content does not support custom post types – only posts are selected even if the custom post type supports the Tags ...
8
votes
1answer
1k views

Mega Menu Walker

I'm trying to create a mega menu walker. Unfortunately, walkers completely escape my coding knowledge. I could really use some help getting it working. Here's the features I need: Wrap the ...
0
votes
0answers
53 views

How to extract URLs from wordpress taxonomies

I am in quite a trouble. I need to extract all possible url from my wordpress blog be it of post, tag, category or anything else after domian-name.tld/*. I tried my hand on few available codes and ...
1
vote
1answer
67 views

Insert HTML inside link in a walker

I've got a custom nav walker that (theoretically) pulls the featured image from the most recent post in a custom taxonomy, and displays the the image after the link in a wp_list_categories. The ...
0
votes
1answer
61 views

Dynamically Generate Functions and Hooks

I'm trying to find if it's possible to dynamically generate functions and hooks. All functions do the same thing, and all hooks are essentially the same. Here's an example of a hook/function combo: ...
0
votes
0answers
42 views

Guest posts with author's url and twitter photo

There's an urgent need for my school website to allow Guest Posts for essay assignments of students. The guest posts submitted by students should provide each student with his/her own url where one ...
0
votes
1answer
47 views

Display a random tag but using cron to control frequency of change

Background - I have created a shortcode in functions.php which adds a single random tag with it's link and description to a widget in my sidebar. This is my existing code... function ...
0
votes
0answers
35 views

Calling Function from link in wordpress

I am creating a wordpress plugin in which i have a function <?php add_action('init','update_subscription'); function update_subscription($category,$user_name){ ...
0
votes
1answer
97 views

How can I use wp_insert_comment to write a comment when a post is edited?

This would mean that when post A was edited by User1, a new comment would appear under post A that reads 'edited by User1', so that the post edit history can easily be seen. A link to the post ...
1
vote
2answers
297 views

How do I add customize_register action AFTER adding a custom taxonomy

customize_register only works with the customize_register hook, and regardless of what hook I use to add the custom taxonomy, it always happens after customize_register. (I want to loop through the ...
0
votes
0answers
55 views

How to Add A Rel Filter to All Links?

How can I add a filter in the functions.php to all links tags? Basically I am needing to add a rel="tooltip" to all my anchor tags within WordPress. I appreciate the help. Thnx
0
votes
1answer
59 views

Posting code inside the post instead of in the template file using shortcode

I am using two plugins one of which is Thumbs Rating which have have a shortcode like this for example in order to display the thumbs rating option: The code bellow is to be used in the templates ...
0
votes
1answer
420 views

How to access global variable $menu inside a class function

am puzzling why can't i access the global variable $menu inside a php class function class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } } using ...
2
votes
1answer
95 views

Enforcing password complexity

We need to enforce password complexity in a wordpress site, we used this article: http://www.webtipblog.com/force-password-complexity-requirements-wordpress/ We created the following in ...
0
votes
1answer
105 views

Is it possible to maintain image aspect ratio when scaling images?

I'm using a theme which displays a grid of images, but it only works with landscape images at the moment (with portrait images, people's heads are cut off). The theme uses custom featured image ...
0
votes
0answers
76 views

Exclude javascript in certain page url and all following url's after forward slash

I'm trying to exclude javascript from a couple of pages. But I want to target all the pages after the forward slash. So I want to to target: www.website.com/page-name/.. So the page-name itself, ...
0
votes
1answer
51 views

Get the alphabetical sorted data with wpdb

I have a function in my WP which get the data from database, Here is the function function thebook_get_provider_types() { global $wpdb; static $provider_types; if (! ...
0
votes
1answer
270 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 ...
0
votes
0answers
129 views

Filter Wordpress post Dynamically on dropdown selection?

Want to filter Wordpress post Dynamically on dropdown selection? But am not able to find out any solution how it can be done.Any help appreciated. Thanks On Clicking On Latest to Old the post ...
0
votes
1answer
73 views

List Categories of the Parent Category of the Current Category

So, let's say I have this structure of categories I. Super Cat A i. mini cat a ii. mini cat b iii. mini cat c I. Super Cat B i. mini cat a ii. mini cat b iii. mini cat c This code: <?php ...
0
votes
1answer
122 views

Custom Nested Wordpress Comments with avatar

I am developing a theme and has no idea how wordpress handles the comment outputs. I have wp_list_comments in my comments.php, but I'm not sure how to customize the output to get the desired output ...
0
votes
1answer
604 views

Replacing select2 in admin backend for all selects

I originally posted this question as a javascript question here, but think maybe it would be better asked here. I tried adding select2 to all wordpress admin screens. However, since many selects are ...
0
votes
0answers
13 views

Getting latest posts from network [duplicate]

I'm using example from here to get latest posts from the WP network: http://www.smashingmagazine.com/2011/11/17/wordpress-multisite-practical-functions-methods/ The function: function ...
0
votes
0answers
128 views

Enable TinyMCE Rich Text editor for excerpt

I need my excerpt to have tinymce activated. I have tried the plugins (TinyMCE Excerpt) etc. but that one is outdated and showed only a rudimentary TinyMCE from the one in main edit window. I need the ...
0
votes
0answers
17 views

Presetting the link of video attached to a Standard Post Format in a custom field

I am trying to create a function that presets the URL (of an attached video in a Standard Post Format) to a custom field when the post is created using a front-end form. (P.S.: All data inputted in ...
0
votes
1answer
74 views

unregister_sidebar in child theme not working

I'm woking on a chid theme for Ohsik. I'm trying to unregister a sidebar, but nothing is working Here's my function.php child theme code: function unregister_footer_sidebar() { unregister_sidebar( ...
0
votes
1answer
130 views

List sibling pages widget, exclude current page

I successfully created a widget that displays sibling pages to the current page I'm on in the sidebar. Only thing is, I'm not capable of excluding the current page - can someone please assist here? ...
0
votes
0answers
105 views

Ninja Forms - pull in some post related information

I am building a real estate website. There is a custom post type, called "Agents", that holds all the contact info, like the email address. I also have a custom post type called "Properties" where you ...
0
votes
0answers
94 views

Get First Image Or youtube Thumbnail with link to youtube video

Looking for a single function to grab the first image or video thumnail (with link to the video location i.e. youtube) Havent quite found one that will work. My youtube file starts with there new ...
0
votes
1answer
1k views

contact form in template with jquery,validate and ajax

I have a page-contact.php for my contact form in my template. I wanted to add jquery validation and some fancy ajax action to my form. This is already a working code in a simple PHP page, but getting ...
0
votes
1answer
215 views

How to set global variables in template page?

I know this works. In functions.php do: $variable = "value"; and in header.php use: global $variable; echo $variable; Is it possible to set a global variable in template page or include php ...
0
votes
1answer
44 views

Print all inline styles to head

Currently working on a project here http://palanquin.shrimp-works.com. When I try to validate what I have done so far, using http://validator.w3.org/, I get lots of this error Element style not ...
0
votes
2answers
150 views

Display custom meta box in my template file

Need help displaying my custom meta boxes on a template file. Following a tutorial Here's the code from my functions.php: function get_custom_field( $value ) { global $post; $custom_field = ...
0
votes
1answer
50 views

Function to return custom post type titles from blog id 1

I'm trying to create a function to retrieve all titles from a custom post type located on blog id=1. I tried to use foreach but I cannot get it to work. The closest I have been was using this: ...
0
votes
0answers
70 views

How to let user know his session has expired and show him a popup?

Can anyone knows how to show a popup once user session has expired? This is what i want to achive When User has been automatically logged out due to inactivity or session expiration I need to show ...
0
votes
2answers
1k views

Function won't run onclick using Ajax

Ok, so my code is meant to be pulled from the function using the jquery code below, but it isn't pulling the code and I can't see why not. My pages code <script> var click_to_choose_user = ...
1
vote
1answer
80 views

php function to display commenter username or login

I want to display the commenters username or login name in a comment template. I know there is a function comment_author_link(), but this displays the "display name publicly as" name and not ...
0
votes
2answers
123 views

User function to return multiple get_post_meta()

I am trying pass a WP function to a user function, where I can pass a new func argument $key for each post_meta type here: functions.php function my_post_meta($key){ $meta = ...
0
votes
0answers
20 views

Count how many articles meet a search after add search field

I create a custom post field named "related_keywords". When i add a post, before save, i fill this field with a list of keywords. After that, I need that it search title posts that meets this search ...
0
votes
0answers
74 views

automatically adding submenu items

Here's the solution that @bainternet has posted here: Add child pages automatically to nav menu /** * auto_child_page_menu * * class to add top level page menu items all child pages on the fly * ...
0
votes
0answers
44 views

Custom Post Type link not showing content

I have created 2 custom post types. One called artist and one called work. When I create a post in artist and view it the link is fine and I can view the content. However in work when I add a new post ...
0
votes
1answer
34 views

Displaying Event within two given time frames

I'm trying to display two different posts from my CPT named Events. One is going to be the next event the other is going to be previous event. I've got a metabox called 'Event date' The client at ...
0
votes
2answers
43 views

Unregistering custom tinymce plugin?

I want to unregister a custom tinymce plugin in one of my child themes. The custom tinymce plugin uses basically: http://codex.wordpress.org/Plugin_API/Filter_Reference/mce_external_plugins excerpt: ...
0
votes
1answer
41 views

Functions are causing errors

I'm declaring a function on a plugin's PHP. The plugin loads code at the top of each post (Post Layout is the plugins name). Cannot redeclare vote_up() (previously declared in ...
0
votes
1answer
30 views

Trying to the deduce shortcode from a function

I have a theme where the wysiwyg button to insert the shortcodes is not appearing. I am trying to manually type in the shortcode that would output the tabs that I need. I am looking at the function ...