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

Add a class to post if it has been recently updated

I'm trying to add 'updated recently' after the post title. I've discovered some code which works but because of plugins and some theme coding it affects numerous instances of the_title that it ...
0
votes
1answer
85 views

Redirect to post after publish or update a published post

How can I get the permalink of a post from functions.php in my theme? I know this code: get_permalink($post->ID); but this produces something like this: mydomain.com/index.php?p=123 and I ...
0
votes
1answer
15 views

Return link pages instead of displaying them

Is there any WP function to return the pages links instead of displaying them with wp_link_pages()?
0
votes
0answers
71 views

Working widget does not show up in appearance->widgets

I try to add a custom widget for use outside of a normal sidebar. For that I have created class myfirst which extends WP_Widget and with appropriate function overrides. namespace widget; class ...
1
vote
0answers
42 views

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
0
votes
0answers
22 views

Automatically create featured image on post publish

I know how to make an image display IN PLACE OF a featured image if the post has no featured image, however, as far as the database is concerned, the post still has no featured image. In my theme, ...
1
vote
0answers
48 views

How to remove custom post type and add category and post name

I have a custom post type called listing and taxonomy for this listing is called listing_cat. At the moment my wordpress permalinks appear in this format ...
0
votes
2answers
92 views

deregister scripts on certain page

i need to exclude certain scripts from running on a certain page. i have tried this code but it's not working - when i inspect the page the scripts are still being loaded into the footer of my page. ...
1
vote
4answers
135 views

jquery won't load in footer

I wanted to move jquery to the site's footer, but that doesn't work. I've tried it with the following code. As you can see, I have a couple of another scripts and they load correctly on the footer. ...
0
votes
0answers
104 views

Problem loading wordpress functions outside of wordpress

I´ve just finished setting up my first ever website and blog, so please be gentle ;) . I am having a problem using some functions outside my wordpress installation (blog.example.com). To be ...
8
votes
2answers
199 views

Displaying the number of updates available in the Admin area

I am having an issue finding out how to display the number of plugins/updates available to call somewhere else other than the admin header. I found the function wp_get_update_data should be what I ...
0
votes
0answers
49 views

Custom frontend post not working?

Hi I am creating a custom post front end submission. This is my code to submit the custom post details. Here the validation is not working as well as it will not submit the post. When i submit the ...
0
votes
0answers
142 views

Wordpress Wp_nav_menu How to create Columns in submenu

i have been trying to develop custom navigation in wordpress. i want to add columns in sub menu item. i want to add images in navigation as well as create Multi column Navigation. Please check this ...
0
votes
0answers
73 views

My post views doesn't seem to be counted correctly

I'm using the following codes to count my posts views, so that I can use it in a widget, but it doesn't seem to be updating correctly. I know some posts have more views than the ones showed on the ...
0
votes
1answer
25 views

Difference between get_userdata() and get_currentuserinfo()

I've already read the WordPress documentation for those functions, but is still unclear for me where is the difference between: get_userdata() vs get_currentuserinfo() As far as I know the ...
1
vote
0answers
50 views

Wordpress PHP Conflicting User Sessions

I'm using the following function to programmatically login users via the frontend: function auto_login() { $username = $_POST['user']; if ( !is_user_logged_in() ) { $user = ...
1
vote
1answer
36 views

Dumping variable in custom pre_gets_post function in functions.php, returns NULL

Problem Summary: I am using firePHP to analyze my variables in a custom function, but it does not display their contents into the console as I would expect. I also used var_dump(), it returns NULL. ...
1
vote
1answer
407 views

Redirect if not logged in?

I've tried this to redirect people who aren't logged in to certain page. It ultimately shouldn't matter what front end page they visit, but should redirect to whatever page is chosen as the landing ...
1
vote
2answers
56 views

How to add a rel attribute to images that contains their categories?

I've added categories to images, so that I can use them to filter images within a portfolio page. Now I'm thinking I need to add the rel attribute to each image that contains its assigned categories. ...
0
votes
1answer
80 views

Create special button on WP Tiny MCE Posts Editor for Shortcodes

I am trying to create a special button on the Tiny MCE editor on the Post Editor of Wordpress. I want to create a button for my created shortcode tooltips. Check out my desired output: ...
1
vote
3answers
59 views

Best practices for multiple Custom Feeds functions

I created two new WordPress RSS feeds in my theme functions: // Custom Feed 1 add_action('init', 'customRSS'); function customRSS(){ add_feed('feedname', 'customRSSFunc'); } function ...
0
votes
2answers
127 views

How to add iOS & fav icons to the theme?

I want to add iOs, Android and favourite icons to the website. Generally I udnerstand how they shold be implomented: link files in the head section and you good to go, however there are many lines ...
0
votes
1answer
53 views

Function in Child Theme not overriding Parent Theme function [duplicate]

I have read up on this and tried it myself, but I cannot seem to figure out how to override a parent theme function using my child theme. I need to know what I am doing wrong (and I am sure there are ...
0
votes
4answers
46 views

How to obtain the current website URL in my theme?

I am working on a custom theme and I have the following doubt about how to correctly insert the link to some section of my website into the theme. If you open this link you can understand what I need ...
0
votes
1answer
32 views

Adding Read More to Custom excerpts

I've added the following code to my functions.php: function new_excerpt_more($more) { global $post; return '<strong><a class="moretag" href="'. get_permalink($post->ID) . ...
0
votes
1answer
62 views

Create input select image URL?

My code in functions is: <input type="text" name="Cat_meta[img]" id="Cat_meta[img]" size="3" style="width:60%;" value=" <?php echo $cat_meta['img'] ? $cat_meta['img'] : ''; ?>"> How to ...
1
vote
1answer
43 views

How to Reference/Echo Variable from Another PHP Function

I have successfully set up a PHP function for my blog posts to create a shortcode to automatically display/style an iFrame tag for a YouTube video, as well as pull in the duration and view count ...
1
vote
1answer
56 views

How do I add Bootstrap and LESS to my migrated WordPress site?

I'm migrating a website to WordPress - it uses both Bootstrap and LESS. I found a snippet online for enabling Bootstrap and the outputted CSS via functions.php: function theme_add_bootstrap() { ...
0
votes
2answers
60 views

Differences when using the the_time and the_date functions

I have some doubts about how work the WordPress the_date() functions definied into general-template.php In a page I show the posts archive using this code snippet into a loop: <article ...
0
votes
1answer
80 views

Can I show also the post date using the wp_get_archives() function?

I am pretty new in WordPress theme development and I have some doubt about the wp_get_archives() function: http://codex.wordpress.org/Function_Reference/wp_get_archives In my website I have create ...
0
votes
0answers
32 views

Creating a filter to modify links ending in .pdf

I'm trying to create a filter that checks for links that are to PDFs, and append the href attribute with something like /form?file=[path to pdf]. For example, starting with: <a ...
0
votes
0answers
18 views

Run function after post is updated

I would like to run a function after a post is saved. That function takes a .txt file thats uploaded with Advanced Custom Field file field, makes it into an array to then a json data. I want the json ...
0
votes
0answers
41 views

Iris color picker

i try to implement Iris color picker in my wordpress theme and it works fine, but when i include the Iris color picker's files i can't call a custom function via a tag. this is the Iris color picker ...
0
votes
1answer
169 views

Is it possible to override this function/class in a child theme?

Is it possible to override this widget function from a parent theme? I saw this blog, but it dealt with a simpler case. http://venutip.com/content/right-way-override-theme-functions parent class ...
0
votes
0answers
38 views

Run a Wordpress function inside a wp_query loop result [duplicate]

I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The ...
0
votes
1answer
45 views

How to load plugin before the wordpress jquery?

I'm fixing a wordpress plugin that uses a 1.0.0 version of jquery. The jquery version automatically included in wordpress is 1.11.0. In a test site, the plugin is dependent on the 1.0.0 jquery and ...
0
votes
1answer
40 views

How to add a piece of code in function

On the function below, after echo '</span>';, I want to add this a piece of code: &nbsp;<a href="<?php $key="link"; echo get_post_meta($post->ID, $key, true); ?>" ...
0
votes
1answer
60 views

Remove echo from shortcode

I've just started playing with shortcodes and due to my lack of php knowledge I am unable to figure out how to make this shortcode work without using php echo. Can anyone help me revise my code? // ...
0
votes
1answer
104 views

Warning: join(): Invalid arguments passed in post-template.php

I'm getting this warning with development mode: Warning: join(): Invalid arguments passed in /webDir/project/wp-includes/post-template.php on line 371 In production mode the <article> ...
1
vote
1answer
58 views

Removing user contact methods works from functions.php but not from a plugin

I'd like to remove user fields and I used this code: add_filter( 'user_contactmethods', 'newfields' ); function newfields( $user_contact ) { unset($user_contact['facebook']); ...
0
votes
2answers
90 views

Page Template Won't Load Correct CSS File

I can't get the correct css file to load for my page template. The page is correctly loading the template but still using the default css file. This is the code I'm using to load the page template's ...
0
votes
1answer
51 views

Why does my visual post editor break when I try to add a TinyMCE button?

I'm trying to add a button to my TinyMCE editor. I'm using WordPress 3.9.1, so I'm following this tutorial to add a new TinyMCE button. Right now, I'm just trying to get the tutorial version ...
0
votes
0answers
18 views

Require featured image snippet not letting me Trash the post

There's a famous snippet which allows you to require a featured image on your post before it gets published, which is following: add_action('save_post', 'wpds_check_thumbnail'); ...
-1
votes
2answers
25 views

How to modify this function to exclude also the post belonging to a specific category?

I am very new in WordPress development and I have the folglowing problem. I use this function (declared into the functions.php file of my theme) to modify the main query in such a way that the post ...
0
votes
0answers
106 views

Remove Captions from Custom Gallery function.php

I like to prevent captions from being outputted in my custom gallery function. I could easily just hide it using CSS but it doesn't feel right. The caption is being sent from media.php this line. ...
5
votes
2answers
217 views

username_exists() function can't be access without logging in

I'm using the following function in functions.php to check if a username exists in the DB function check_username() { $username = $_POST['user']; if ( username_exists( $username ) ) { ...
0
votes
1answer
41 views

Automatically delete posts based on query

I'm trying to delete certain posts (of a custom post type) automatically based on a comparison between the current time and a number of hours previous to now, for example 24 hours. The custom post ...
4
votes
1answer
68 views

How to add classes to images based on their categories?

I need to be able to: 1.) assign categories to images and 2.) add classes to all images that correspond to their assigned categories. I was able to add categories to images with the following: ...
0
votes
2answers
121 views

Wordpress listen to $_POST in functions.php

I currently have the following function in my functions.php which checks if a username exists in the DB. function check_username() { $username = $_POST['user']; if ( username_exists( ...
0
votes
1answer
24 views

Unable to Call More than One Meta Box Output

I have a custom meta box with multiple text fields. I use this to call the information in the first box: <?php the_post(); echo get_post_meta( get_the_ID(), 'dbt_text', true ); ?> And this to ...