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

add classes to wordpress menu links

As the title already says, I am trying to add classes on the WordPress menu item links (so not the li, but the a element). If it is possible to achieve something similar to WordPress its own function ...
0
votes
1answer
16 views

Get category id for a custom category and display it in a class

I am having trouble displaying my custom category ID to my li ID. The code I am using below is displaying the post ID of the post category instead of the custom category. What I am trying to do is ...
0
votes
0answers
10 views

Meta description ellipsis [duplicate]

I have a function that puts a meta description in my theme's <head>. It works well but I have a small issue. It just cuts off words in the description once it reaches the 160 character limit. I ...
0
votes
1answer
35 views

Hide a div when a custom field is empty

I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg ...
0
votes
1answer
69 views

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more ...
1
vote
0answers
89 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: ...
0
votes
0answers
24 views

Shortcode to get child pages of multiple parents (using parent slug)

I'm using a nice shortcode to get the child pages of a specific page, using just the parent page slug. [getChild name="page-slug"] This is done using this code: function getChild_function($atts){ ...
0
votes
0answers
20 views

Password Protected Page Redirects To Dashboard on Submit

I am trying to use the built in post/page password protection feature on Wordpress 3.4. However, on the password protected page when you click submit, you are taken to the wp-login page or dashboard, ...
0
votes
0answers
23 views

Merge / Combine two php functions for Previous and Next Link with Thumbnail

I will wrap two merged php funtions in one div container - so i have only one php function and one link to the next post, regardless if someone clicks on the thumb or the text part. These are the two ...
0
votes
1answer
56 views

How to add 'data-caption' inside an anchor tag

bellow is custom gallery code. function custom_gallery_shortcode( $attr = array(), $content = '' ) { $attr['itemtag'] = "li"; $attr['icontag'] = ""; ...
0
votes
0answers
26 views

wp_mail recipient

I am new at this and seeking help, I'm really need a light at the end of the tunnel, so if you can help me, please do it! I will be very grateful! The question is, what do I do to when someone fills ...
0
votes
0answers
19 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
31 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
30 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
19 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
8 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 ...
-1
votes
1answer
40 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
44 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
17 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
47 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
18 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
17 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
30 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
35 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
86 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
33 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
54 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
34 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
40 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
62 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
41 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
46 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
309 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
47 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
268 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
55 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
52 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
30 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
26 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
22 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
31 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
73 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
47 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
181 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
100 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
43 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
37 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
35 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
76 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: ...