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

Proper use of add_option() function?

I would like to add a variable to my site's database. I used add_option() to do that, but it's not working somewhy properly. Probably it does not save the option. my code is: $heatall3 = '10000'; ...
0
votes
2answers
15 views

Pagination custom query

I am trying to make a custom page template that shows the most viewed posts. I can return posts but I am having trouble figuring out how to paginate it. Here is what I have: $args = array('orderby' ...
0
votes
0answers
8 views

Add Class to Tag Cloud Links and Change Terminology

Is there a way to use functions.php to add a class name to all the tag cloud links? This topic does what I need, but it's not through the functions.php file. I was also hoping to change the tag cloud ...
0
votes
0answers
10 views

Countdown to post date tag function?

I made an events post type and I wanna make countdown to post date, for example: Let's say the post is due 5 days later so it writes in the post '5 days remaining' Any suggestions?
0
votes
0answers
7 views

Rewrite rules for subterms in custom taxonomies

I am using a large number of custom taxonomies. My post type is called "location" and there is a parent term "Asia" and a subterm "Thailand". Now I created the taxonomy archive template files ...
0
votes
0answers
27 views

ajax/jquery only works on index.php frontpage [on hold]

I have absolutely no idea why it happens. You can check my blog here. The menu and the lightbox for single post work fine but not in the page level. I've checked but the page.php basically just shares ...
-1
votes
1answer
24 views

How to display login form anywhere, when user isn't logged in, without redirecting?

I'm currently using Theme My Login, and I'm building a membership website where nothing is accessible to anyone, unless they're logged in. When a user, who isn't logged in, enters anywhere on the ...
0
votes
2answers
26 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 ...
0
votes
0answers
12 views

Show the online status of the current post's author

Is there a way that I can show the online status (Either online or offline) of the author of the post that a site visitor is viewing? I imagine it's something to do with the Transients API ...
0
votes
2answers
19 views

Overriding methods in a child theme

Guided by the Codex doc on Child Themes I have created a twentythirteen-child theme for my website by copying the unchanged index.php file from the parent theme and by creating this simple style.css ...
0
votes
0answers
12 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
13 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
25 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
24 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
0answers
8 views

Adding product attributes/variations from the frontend on woocommerce [closed]

I already have the template pages and functions for adding a variable product! I also have an edit page, where the frontend user can add attributes and then create variations. What i would like to do ...
0
votes
1answer
49 views

posts to get expire (deleted) after a date

i am creating an coupon site from scratch and for this have saw many codes and examples on the internet. but it doesn't work as my requirement is little different. i need help in creating an expiry ...
0
votes
0answers
7 views

Woocomerce - Add Bank Name to the fields list in Our Bank Details [closed]

I would like to move the bank name, in this case "Standard Bank", to the details listed on the frontend and email template, instead of next to the Account Name, without hacking the class file. Im ...
0
votes
1answer
18 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 ...
-1
votes
0answers
21 views

Is there a function like wp_remote_fopen that takes a post/page ID instead of a URI?

We have dev and test environments that are only accessible from the internal company network but our WP installations (only part of the whole domain) are hosted on Amazon Web Services. I have need ...
0
votes
2answers
26 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
7 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
1answer
13 views

How to display post tags through the functions file

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
33 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
30 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
32 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 ...
2
votes
9answers
243 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
32 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 = ...
3
votes
3answers
209 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?
0
votes
3answers
39 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, ...
0
votes
1answer
31 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
27 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
12 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
16 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
27 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
47 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
28 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
161 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
30 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
45 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
18 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
32 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
25 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
59 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
16 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 ...
1
vote
1answer
46 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 ...
6
votes
1answer
315 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
24 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
27 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
28 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
25 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 ...