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.
3
votes
5answers
985 views
wp-admin page is blank
Something is wrong with my wp-admin page, it just shows up blank. I am pretty sure it has to do with my function.php file there is no whitespace on the top or bottom, but when I delete it completely, ...
0
votes
0answers
11 views
If user removes section with theme customizer I want it to add padding to footer
I added the ability to the theme customizer for the user to remove a section that is above the footer. The issue is when the section is removed it is causing the links in my footer to move up.
How ...
0
votes
0answers
25 views
Problem with function not executing
I am sorry for the long post but I wanted to be thourough in hopes someone could help me figure out this issue. I have been trying to get it working for 2 days with no such luck. I would appreciate ...
1
vote
0answers
30 views
Way to add captions to gallery images by code
I am creating posts by using wp_insert_post function. It works fine as I provide values in array required. Sometimes it is required to create a post having gallery. Without any problem, it also works ...
0
votes
1answer
12 views
Changing the post date and time with function
What function can be used to update a post's post date and time to the current date & time?
0
votes
1answer
46 views
Custom post type isn't working
I just built up a beta environment for testing my new Wordpress site. I didn't migrate the database; I did my own installation again and ported over my theme (it's a simple theme) to my new instance. ...
0
votes
1answer
31 views
How to change pagination base from slash to query form?
Can this function...
function custom_pagination_base() {
global $wp_rewrite;
$wp_rewrite->pagination_base = 'p';
$wp_rewrite->flush_rules();
}
add_action( 'init', 'custom_pagination_base' );
...
0
votes
0answers
46 views
User driven content problems
I am trying to build a website that will allow users to post from the front end. I need to be able to have the user enter a title, a category, and tags. For the content of the post, I would ideally ...
0
votes
1answer
40 views
Mamp pro permalink issues. Pages keep reverting to index.php
So I pulled a site down to my local machine to do some work on it. Copied the files, find/replace on the database to update the url, added a host. Everything worked fine until I changed the permalink ...
0
votes
1answer
413 views
How to make excerpt image be full size instead of thumbnail?
Now when I have excerpts on the home page the image is a small square, but I'd like to change it to a fill the entire width of the content area. (as if the image was in a post.) My theme is responsive ...
0
votes
2answers
40 views
Code to auto expire posts after 30 days
I've tried the plugins that are available in the Wordpress plugins section but they seem to fail miserably. Initially, I used Auto Post Expire By User Role which worked for a time, but for some reason ...
0
votes
2answers
218 views
Automatically assign a custom post to a custom taxonomy based on custom field value
We have a custom post type called listings, and each listing has a custom field zipcode (which is a 5 digit number). We then have a custom taxonomy area, which can be "New York", "Los Angeles" etc.
...
0
votes
2answers
827 views
How can I remove the title “leave a reply” in the comment box in twentyeleven?
I would like to remove "leave a reply" in the comment form in twenty eleven. How can I do this? Thanks in advance.
0
votes
0answers
26 views
How do I link a button I created in theme customizer to a function?
I created a button in the theme customizer and I want to use it to execute a function? All I can find is using controls to add theme settings such as CSS and text. Although this button is to clear out ...
0
votes
0answers
32 views
Created custom control from theme customizer, where should I add code it will control?
I have created a custom control for the theme customizer which is a simple button and label. I am going to be using it as a theme reset button that will clear the theme mod settings to their original ...
0
votes
1answer
38 views
How to add button to top of theme customizer?
I am trying to figure out how exactly I can add a button to the top of the theme customizer. The spot I am talking about is where the "close" and "save" buttons are. The ones that are above everything ...
1
vote
1answer
38 views
List of all theme customizer control types?
I have been looking through the theme customization API documentation and google to simply find out the names of the control types already built in to the theme customizer.
More specifically I am ...
0
votes
0answers
49 views
Press this! not working
I am trying to debug a Press this function on a site {Adult Contents}
This issue is, images on the page does not add up and does not show...
javascript code for press this button is
javascript:var ...
0
votes
1answer
30 views
Exclude category
I want to exclude a category from showing in a function, but cannot figure out how to do it for my specific code as below. I want to make it so that any post that is in the "featured" category, does ...
1
vote
1answer
28 views
changing function wp_register
how can i change function in general-template.php without affecting this core file on this:
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
$link = $before . '<a ...
0
votes
3answers
2k views
Custom page template how to check is_page from functions.php?
Have a custom page template and trying to make the excerpt length dynamical depending on what page you are in.
Functions.php
<?php
function custom_excerpt_length($length){
if (is_page(15)) {
...
1
vote
1answer
47 views
qTranslate in functions.php
I have a function which redirects user to certain page:
wp_redirect('http://address/page');
Usually I would just use:
<?php _e("<!--:en-->english ...
168
votes
108answers
59k views
Best Collection of Code for your functions.php file [closed]
Please vote on the question and any answers you find useful by clicking on the UP arrow on the left hand side of the question or answer.
As with many others who are now viewing this post, I have been ...
0
votes
0answers
32 views
Wordpress adding in site URL to header links
A little information: I am developing a one page theme that uses posts as sections on the main page. I have created code that allows users to add a menu item in the post page from a meta box when they ...
0
votes
1answer
33 views
How can I create a menu items from meta box based on users input
I have created a metabox that takes a name that the user can give as an additional name of their post. I am wondering how I can automatically create a menu item based on the name the user input into ...
0
votes
0answers
32 views
How to tell if string is null or empty in meta value? [closed]
I am trying to figure out how to find out if a string is null or empty in php. The place I am pulling the value from is a meta value that is stored from a meta box on the post page.
I want to check ...
-1
votes
0answers
19 views
How to build a search form explanation [closed]
Can somebody help me to build a advance search form like this...http://www.tvblog.ro/seriale-tv/
Wath keyword i shoud search on the web to find more explanation
A short model would be apreciate..
-1
votes
1answer
32 views
How can i hide content if not friend in Buddypress?
How can I hide some specific contents or div or other stuff depending on being friend or not in buddypress ??
I tried to use the bp_is_user_friends() function but it did not work !
1
vote
1answer
20 views
Trying to retrieve post meta
I have created a meta box that allows users to add an additional name/id to their post. From what I can tell it is adding the meta information correctly because when I edit a post that has a custom ...
-1
votes
0answers
15 views
Reset Button for Custom Plugin (reset to default settings with php not using settings api)
I have a custom plugin I am creating for wordpress in php. It's simple one with whitelabeling functions. I am trying to create a reset button. I know how to create the field. I think I can do it by ...
0
votes
1answer
63 views
Get post meta retrieving wrong value
I created a custom meta box with a textbox where the user can enter a custom value in as an additional identification tag. I thought I had it right but when I try to retrieve the value it is giving me ...
0
votes
1answer
118 views
Adding class to last list item? Not WP generated
this one has been getting me for a while. At the moment I have a repeater field with Advanced Custom Fields:
<ul id="servicelist" class="clearfix">
<?php if(get_field('homepage_service')): ...
1
vote
1answer
151 views
Change comments form title on a page by page basis
I'm looking to change the comments form title (my theme defaults this to "Leave a Comment" or "Leave a reply to").
I thought perhaps I could add a hook to comment_form_defaults but my snippet below ...
8
votes
3answers
169 views
How to change the case of all post titles to “Title Case”
I am helping my father with his WordPress website.
It has over 1,700 posts with TITLES IN UPPERCASE.
We'd like to change these to "Title Case" in the database (possibly using this PHP script).
The ...
0
votes
1answer
273 views
correct way to call javascript into hook function
function node_wp($post_ID) {
global $post;
$post_title = get_the_title( $post_ID );
$post_url = get_permalink( $post_ID );
$json = array(
'title_post' => $post_title,
...
0
votes
1answer
80 views
Post to category based on email domain, for a post-by-email plugin
I have a wordpress plugin installed called Postie - it enables me to post to my wordpress by sending an email to a specific email address.
I need help with some coding in order to make it so it will ...
0
votes
0answers
33 views
How can I clear the theme mod settings?
Ideally I am looking to add a button to the theme customizer that allows the theme to reset to default settings, although that may be asking for too much in one question so I am wonder if anyone knows ...
2
votes
1answer
222 views
Check if post is being published for the first time, or is an already published post being updated
I am building an add-on to an events module that checks for availability, since there wasn't a function for that in that module. Now that I have built the logic, there are three emails I will need to ...
0
votes
1answer
39 views
Custom <blockquote> HTML markup
In Wordpress, I would like to add a custom styling to the <blockquote> elements, replacing Wordpress' default usage by using a function (or however is easiest).
When using the WYSIWYG editor, ...
0
votes
2answers
67 views
gform_after_submission content appears immediately after <body>, not in post body
I have the following function that successfully uses form fields (IDs 13 and 18) from a Gravity Form (ID 18) as parameters within wp_query.
This displays a list of posts with specific taxonomy terms ...
2
votes
2answers
55 views
How can I add dropdown widget/box to admin post page?
I am trying to figure out how to add a dropdown widget to the post page. The reason I ask is because I would like to be able to have a few different post classes that the user can select while making ...
-1
votes
0answers
41 views
Is it possible to dynamically add widget areas?
I am creating a very custom and unique theme that uses posts as sections for the front page. The posts all have a configured style to them, so I am wondering if it is possible to dynamically create ...
0
votes
1answer
66 views
How to use a variable as a function name?
I'm trying to loop a function that will let users create a few custom posts, but I have a problem with the function name. Here is an example:
How can I write this:
function ...
0
votes
0answers
31 views
Cant get theme to change footer color through theme customizer
I am having an issue trying to configure the theme I am working on to allow the footer color to be changed. So far all of my other options work so I am geussing it is an issue with the way I am ...
0
votes
2answers
50 views
Theme not calling Jquery properly
I am developing a theme and I have called jquery along with other JS files from a theme-enqueue.php file. For some reason only the Jquery file that is hosted on googles servers is adding the theme URL ...
4
votes
1answer
85 views
Remove a menu item created by a plugin
I'm trying to remove a menu item and tried several approaches, but have not had any luck. It was created from a FAQ plugin.
If I use this line:
remove_menu_page( 'edit.php?post_type=question' );
...
0
votes
2answers
72 views
Theme Customizer not loading JS for live preview
I am currently working on adding options to the theme customizer. For the last two hours I have been trying to get the live preview working and I am trying figure out why my theme isn't loading the ...
6
votes
3answers
301 views
Where do I put the code snippets I found here or somewhere else on the web?
Many posts here or somewhere else contain code, but they do not say where to put it.
Example:
I have found this post: How do I turn off 301 redirecting posts (not canonical)?
I'm a newbie with PHP. ...
7
votes
4answers
4k views
What's the difference between home_url() and site_url()
My understanding is that site_url() returns the location where the wordpress core files are.
So, if my blog is hosted at http://example.com/blog then site_url() returns http://example.com/blog
But ...
0
votes
1answer
36 views
Remove “Published On” inside wp-admin
How do I remove this? Preferaly would like to do an action hook inside functions.php to remove this. I don't want the editor to see/edit when they published the article.
Thank you for your help.


