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
0answers
20 views

Load mutiple stylesheets inside one IE condition

I want to load Load mutiple stylesheets inside one condition for Internet Explorer: wp_enqueue_style('ie-style', get_template_directory_uri() . '/style-ie.css'); wp_enqueue_style('ie', ...
0
votes
0answers
19 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...
0
votes
1answer
37 views

Execute only on a certain page

I"m trying to get the block of code below to load only when it's the contact page but it doesn't seem to wotk. Any ideas what the problem could be. Still pretty much new to PHP. if ...
0
votes
2answers
40 views

How to have Function of a plugin using global vars into a shortcode?

I am trying to convert this piece of code into a shortcode so it can be used inside my posts. Is it possible? I cant think of how to do it as I am beginner in wordpress and learning via books/youtube ...
0
votes
1answer
136 views

Posts to expire (deleted) after a date

I am creating a coupon site from scratch. I have reviewed many code examples on the Internet, but have not found anything that will work, as my requirements are little different. I need help in ...
0
votes
1answer
40 views

How to add an anonymous function in wordpress hooks by removing create_function

Currently I have the code below which I would like to replace create_function with some anonymous function. How can this be done? add_action('widgets_init', create_function('', 'return ...
0
votes
2answers
89 views

wp_get_attachment_image_src returns image on main domain, false on subdomain

I've got a multisite install in development where both the subdomains and the main site use the exact same page templates for showing data. However, when I try to get a profile image (added ID in ...
0
votes
0answers
62 views

Limit to One Custom Taxonomy Selection, Including Most Used

I've got a bit of code that limits my custom taxonomy to only allow the user to select one category, by turning the checkboxes in to radio buttons. See the screenshot below for example: I need the ...
2
votes
3answers
65 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 ...
1
vote
1answer
247 views

Recent post display using shortcode

I am trying to display recent post in static page home-content.php. I've added this code in function.php function my_recent_posts_shortcode($atts){ $q = new WP_Query( array( 'orderby' ...
0
votes
2answers
60 views

Stuck on maintenance mode

I put my site in maintenance mode using this hook in functions.php, function activate_maintenance_mode() { //If the current user is NOT an 'Administrator' or NOT 'Super Admin' then display ...
0
votes
1answer
70 views

Functions.php in child theme that loads CSS file breaks website

I created a child theme and created a functions.php file in the child theme directory that also has the required style.css file and a seperate custom CSS file that I want to load. This is the code I ...
3
votes
9answers
453 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 ...
0
votes
1answer
62 views

Checking for existence of a page by title?

I'm currently working on a plugin, and I essentially want to check if a certain page has been created. Essentially, I want to do something like this: if (file_exists($file)) { $exists = ...
5
votes
3answers
374 views

Difference between the_permalink() and get_permalink() function

In WordPress I am using both the_permalink() and get_permalink() functions, but I cannot get any difference in the output of both functions. What is the difference between both functions?
1
vote
3answers
74 views

Show excerpt for only first post in query

I'd like to only show the excerpt for the first post in my main query. I was wondering the best way to approach this. What I have tried so far is: Making a custom homepage and using two queries, ...
1
vote
1answer
98 views

'Attempt to modify property of non-object' warning

I use the bellow function to disable a plugin update. It works, because I use an old version of this plugin and it does not show me that a newer version exists, but, however, I get a warning on line ...
0
votes
1answer
36 views

Post type no single page

I have created a post type and I am trying to create a single page for that post type, I am creating a php file called single-job.php and it is using the index.php as a template. Below is my function ...
0
votes
1answer
54 views

Using a private method as an action callback from within a class

I have created a class from within which I would like to call a private method (from within the same class) from the __construct method as an action callback. When I would like to use a public method ...
0
votes
0answers
28 views

Get site owner meta to show publically on front end in multisite? using “user meta shortcodes” plugin

I've searched all over for a fix and have had no luck. Im using the "User Meta Shortcodes" plugin to display user meta. The plugin works fine, the problem is that it doesnt output the meta info from ...
0
votes
2answers
34 views

Update functions.php from Wordpress dashboard

I'm sure this isn't possible but I thought I would ask. In my functions.php file I have a wp_mail function that sends an email to moderators when posts are made. This email is sent to number of ...
0
votes
1answer
94 views

Wordpress - thumbnail image from youtube (function and loop)

Hi :D i need show thumbnails from youtube in homepage, i have a code for wordpress in function and the loop but not working thumbnail from youtube. What can be wrong with the code? Function Code: ...
0
votes
1answer
84 views

Call two different function.js depending on page

I'm trying to find how I can call 2 different function.js depending of the page. When on "home", I want to load "function_2.js", and on the other pages of my website the original "function.js". I ...
1
vote
1answer
190 views

Run a filter when a walker runs

Is there any way to run a particular add_filter function whenever a specific Walker_Nav_Menu class runs? The function always needs to run when the walker goes, and I'd like them to share variables, in ...
0
votes
1answer
31 views

Create html from function

I have a simple html structure like this. <div class="ideaPost"> <a href="<?php echo get_permalink($post->ID); ?>"> <div class="ideaPost__Info"> ...
0
votes
1answer
192 views

How to use different jquery function of idangero swiper dependant on page template?

I have struggled with adding the idangero swiper jquery plugin to my site, but have managed to produce the code below. This works very well but only on the one custom page template defined in the ...
0
votes
1answer
97 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
48 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
48 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
85 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
254 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
885 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
46 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
52 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
50 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
39 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
42 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
32 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
77 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
230 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
43 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
54 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
255 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
72 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
49 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
65 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
45 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
181 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
116 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 ...