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
48 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
57 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
230 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
96 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
13 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
35 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
74 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
67 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
77 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
857 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
128 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
35 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
81 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
39 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
60 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
482 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
62 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
64 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
19 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
47 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
33 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
29 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
34 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
40 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
29 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 ...
1
vote
1answer
46 views

How to hide, and not to remove the attributes metabox?

I need to hide, and not to remove the attributes meta box in the backend. The following code is removing the metabox: function hide_meta_box_attributes() { remove_meta_box('pageparentdiv', 'post', ...
-1
votes
2answers
140 views

Redeclare a function in a child theme

I want to redeclare a function that I inherited from the parent theme. When I do it in functions.php, I get a fatal error that redeclaration is not possible. I did a workaround: creating a modified ...
0
votes
1answer
25 views

Combining wp_current_user() and a variable

I want to match a custom field in a user's profile to a particular post the user might be on. So I've got the custom fields for user profiles setup, and they're all numeric. Then, if I'm on a post ...
0
votes
2answers
36 views

Wordpress plugin options need to delete after deactivate & uninstall

I have developed a wordpress plugin and I need to delete the options I am creating when uninstalling. What I did is I created a file called uninstall.php and included the following code: <?php ...
0
votes
1answer
77 views

Allowing users to view private posts (pending approval)

OK so I mostly fixed this myself I went into post.php in wp-includes. Changed the 'protected' => true, of pending to 'public' => true, but every time wordpress updates this will reset (I ...
1
vote
1answer
40 views

Get list of years when posts have been published

I want to create a list of posts from a Custom Post Type and add some filters the user can click to filter the list. I added filters for all the categories by using the get_terms() function. Now I ...
0
votes
1answer
73 views

Optimize CPT-function with a loop

I want to optimize my functions of a Custom Post Type (CPT). Now I have 10 meta boxes. For each box I have an extra function. The aim is to produce the 10 boxes in one function. I already tried the ...
0
votes
0answers
60 views

Init hook for header send

I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea ...
0
votes
1answer
39 views

Why There Is No “get content by ID” Function

When i need to get content of a post with ID, I'm always using this function : function getContentByID($id) { //http://wordpress.stackexchange.com/questions/9667/get-wordpress-post-content-by-post-id ...
0
votes
2answers
31 views

How to print the current post depth as update notification?

I need to find a simple if-condition to print the current post-depth for parents as an update notification. The following code in the functions.php is not working, it is resulting in "0" for all ...
0
votes
1answer
29 views

Insert wordpress tags below posts via functions.php

I'm in the process of building my own Wordpress theme from scratch and my knowledge of PHP is limited. What I'm trying to do is insert tags below each post. I can do this by inserting code into my ...
0
votes
0answers
76 views

Custom Menu echo own HTML

I've registered a custom menu and got all that set up, however the formatting of the HTML that the menu uses doesn't fit with the CSS/HTML menus I had previously and want to keep. Therefore I was ...
0
votes
1answer
54 views

Changing the header image using WPML

I've got an issue with changing a header image based on language and the file path to the image. Have tried relative and absolute paths but still end up with a broken/missing file icon. In my ...
0
votes
1answer
52 views

Proper way to use plugin functions in functions.php

I just ran into an annoying problem on one of my WP sites. I'm using the qtranslate plugin and in the functions.php of my theme, I access some of that plugin's functions. Now, it seems that ...
0
votes
1answer
64 views

How to safely edit functions.php

I was wondering how you can safely edit (like see the changes before actually updating) functions.php. I was wondering this because a while ago I made a error in functions.php (one too much..) and it ...
-1
votes
1answer
518 views

How to Display Post View Count

I am trying to display post view counts. I've tried below function to display the post view count, but I'm getting same post view for all the post in loop. Not getting correct post view count. ...
0
votes
0answers
52 views

add_rewrite_rule regex issue

I am trying to add the following function into my functions.php through the WordPress editor but every time I try it says error 403 Forbidden - Access to this resource on the server is denied! ...
2
votes
1answer
29 views

How can I modify the permalink via a filter?

I would like to make a change to the URL's in my href attribute across my while site when the_permalink is called. For example: <h2><a href="<?php the_permalink()?>" Can I use my ...
0
votes
1answer
19 views

Why isn't my custom function kicking in from my functions.php file?

We'd like to clean some of our WordPress URL's up and have some rewrites in place in the following format: Actual URL: product-one/product-one-guides/ Actual URL: product-two/product-two-guides/ ...
0
votes
0answers
21 views

Admin-area broken through weird issues

Sorry for my bad English - it is not my mother language. Just installed wordpress 3.9. The admin area looks a bit broken all though I have fixed some things with switching the magic quotes to off ...
0
votes
1answer
38 views

Postmeta not saving

I'm created a postmeta box but it doesn't appear to be saving anything to the DB. I'm check in wp_postmeta and there is nothing there relevant to this metabox. I believe it is something wrong with ...
1
vote
1answer
34 views

Loading all files within a directory

I've made this little function which I'm wanting to call all the files within a directory. I don't think the glob() == false would work though. I'm new to this function so not aware of all ...
0
votes
0answers
45 views

How to get posts from network blog

So I have function that gets posts with URL(id) (ajax stuff). It works but now I would like also fetch posts from other blogs in my network. I'm baffled how can I achieve this? Do I have to know the ...
0
votes
0answers
28 views

<a>tag in register_sidebar

I use this sidebar widget between thumbnail posts. When I insert <a href="example"><img src="example2"></a> tag in widget, its size and position show post`s size and position ...