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)

2
votes
1answer
151 views

Delete pages and Create default pages for all new network sites

I am using the following code to delete some default pages and to also create some default pages for all new sites that are created. It work as is now but that is only because I purposely have a ...
2
votes
1answer
105 views

How can I list random authors from current post category?

The following lists authors of the current category. But I want this to be a list of 6 random authors from current post category. foreach((get_the_category()) as $category) { $postcat= ...
2
votes
1answer
348 views

Changing post category from dropdown

I am showing a list of posts on the front of my wordpress site which each have a dropdown next to them with a list of category's, which are pulled in as follows. As you can see the form submit button ...
2
votes
1answer
5k views

Using wp_get_nav_menu_items() to list children of children pages

I'm working with a Genesis Based Theme and I'd like build a Page/ Child Page menu structure. That part I can do with the help of some code produced by Bill Erickson. Essentially what I'm trying to do ...
1
vote
1answer
19 views

changing behaviour of get_search_form

I created a function to display a search box and named it my_get_search_form() that is a copy of original get_search_form() function. when I call the function, the output is this: Search in ...
1
vote
1answer
28 views

Usage of theme name in functions

I've been studying some functions.php files to get my head around theme development, and I keep stumbling upon a reference to the theme name inside functions. Something like this: <?php ...
1
vote
1answer
49 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
51 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
80 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 ...
1
vote
1answer
165 views

How to get correct URLs in network wide menu (Multisite)?

I'm using this function to switch to my main website's navigation and display it on all sub sites in my multisite network. Ideally the links should have the following format: ...
1
vote
1answer
306 views

Defer all js except certain ones in functions.php file

I read How to add defer="defer" tag in plugin javascripts? and the code @toscho posted works good to defer certain js files or deferring ALL js files by commenting out the contact-form-7 ...
1
vote
1answer
432 views

How to set the jpg image compression for specific thumbnail sizes?

This question was asked on Set JPEG compression for specific custom image sizes and answered very nicely by Ahmad M I'd of course comment to that thread but I don't have 50 point reputation... The ...
0
votes
0answers
130 views

Pass PHP variable between functions in functions.php

I have a WordPress Admin page where you can add a "listing". Within this Admin Page I have added many fields which transfer variables over to the listing page which is created/updated. Within this ...
0
votes
0answers
112 views

Function working in single.php but not working in custom template file

I defined in my functions.php the following code: function fix_footnotes($content){ return preg_replace('/href\s*=\s*"[^"]+(#[^"]+)"/','href="$1"', $content); } When I call this ...
0
votes
0answers
47 views

Disable Override in WooCommerce

In my WP theme i've created a folder called "woocommerce" and inside that i put all file with my custom code, based on WooCommerce guidelines: template structure All work fine, but is possible to ...
0
votes
0answers
88 views

functions.php conditional output for a single plugin

hope I've asked this correctly. Bizarre situation. I have some non-breaking spaces in my titles for typography reasons. They are added automatically where required in place of normal spaces by the ...
0
votes
0answers
48 views

How to request login for user but not for bots

I wondering, how to not requesting bots like google crawler or bing crawlers to login since they can crawl my post info, but require user to login if they want to see the posts? I already know how to ...
0
votes
0answers
286 views

How to make woocommerce a private catalog

Are there any tutorials/functions/custom code that I could utilize to make my entire shop pages completely private to users? I need a private shopping experience for logged in users only. My client ...
0
votes
0answers
128 views

All “Featured Images” not displaying after Wordpress update

After updating to the latest version of WordPress today, I noticed that all "Featured Images" on my website are no longer displaying. After trying to figure the problem out for hours, I added the ...
0
votes
0answers
38 views

Create user from external file

I have this little script for create user from page of template i use in wordpress template page : $user_name = "usertest"; $user_pass="123456"; $user_email="myemail@domain.com"; wp_create_user( ...
0
votes
0answers
50 views

WP Function still having effect after being deleted

I wanted to hide the add to cart buttons in Woocommerce so I created a custom plugin and added the following code to it: function remove_loop_button(){ remove_action( ...
0
votes
0answers
33 views

global vars in wordpress no works fine

I have 2 global vars defined inside funtions.php global $ruta_path; global $ruta_db; I want send the value of this global values to function in comments but no get works Inside comments.php i have ...
0
votes
0answers
110 views

Site is not updating because something is wrong with custom code. How to fix it?

I really didnt know what a proper title for this question could be. Anyways, I have this code in functions.php which is breaking my site function wp_show_post_views(){ global $post; $postid = ...
0
votes
0answers
55 views

using enqueue_script in a shortcode isn't working

I'm new to wordpress and I'm trying to get this to work by following the wordpress codex but I feel like I must be missing something obvious. I have a child theme based off of a parent one, and I ...
0
votes
0answers
278 views

Display default WordPress login/registration form into a modal window

hope someone can help me with this. I need to display the default WordPress login/registration into a modal window. I followed this tutorial in order to create the modal box and it is just exactly ...
0
votes
0answers
425 views

How to fix Warning: call_user_func_array()?

I modified my theme metabox.php to fit my needs, and I got this eror Blockquote Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'mytheme_add_box' not found or ...
0
votes
0answers
48 views

How to structure plugin in to functions?

So I have customized a few plugins before, but never developed one from scratch. One thing that I have struggled with is structuring my functions. I found the following snippet and wonder how YOU ...
0
votes
0answers
82 views

Adding result from PHP function into an input field

I have the following PHP code which is a template page for a wordpress site: <?php /* Template Name: Calculator Form */ get_header(); ?> <div id="content" class="grid_7 suffix_1 <?php ...
0
votes
0answers
186 views

Functions.php not working in 2013 Child Theme

I have created a child theme base on the new twentythirteen theme. I made a style.css file and put a few styles in it. I've selected the child theme and my css styles are working. No problem there. ...
0
votes
0answers
231 views

HTTP_HOST changing in functions.php

I have getting variable results from the $_SERVER['HTTP_HOST'] variable in the functions.php file of our child theme. Let me explain our setup and then I'll explain the issue. We are running WP ...
0
votes
0answers
63 views

Using array page name together with page id to deregister script

If I use this: if (is_page(array(blabla-test-page, 20726, 20720, 38881))) {wp_deregister_script( 'gdsr_script' ); } the blabla-test-page looks like it overrides different pages, even if certain ...
0
votes
0answers
179 views

Changing /author/ link to something else: what is a better way?

Is there a better way than this snippet I am using? function change_author_permalinks() { global $wp_rewrite; // Change the value of the author permalink base to whatever you want here ...
0
votes
0answers
206 views

Full size image option removing problem

I have removed the Full size image option from the media upload window see Code: function theme_t_wp_set_image_size_options( $sizes ){ $sizes = array( 'thumbnail' => 'Thumbnail', ...
0
votes
0answers
511 views

How to add a class name to the ancestor <li> of a post?

I've asked this question before with a different Question Title over at Stackoverflow. At that time, I was not yet aware that a function of the theme is adding a class name called current-menu-item. ...
0
votes
0answers
73 views

syntax error unexpected '}' at 364 line

I am getting this error on my website and am not able to access admin dashboard. The error occurs when I am a new theme on my website. Can you please help me to find this error. Parse error: ...
0
votes
0answers
48 views

get_post_meta no longer working

I am trying to use get_post_meta to return a value from the post meta, it was working completely fine then suddenly stopped working. I've tried and checked everything and i cannot seem to get it ...
0
votes
0answers
52 views

Highlight posts currently being edited on multiple editor site?

I have a custom page that uses the Cleverness To-Do List plugin to display multiple posts on a page. My site has multiple editors, and if a post is currently being edited on the custom page (not the ...
0
votes
0answers
87 views

How to delete in the pages the pre tag added automatically by Wordpress

i have been looking around but there is not a specific answer to my issue. I have set up a slideshow by Wordpress, then i paste the short code in the page where i want to display. The slideshow is ...
0
votes
0answers
22 views

New theme crashing site

I have recently recreated a theme on our site. I took the old theme as a base and started messing around and trying to be more efficient with our code and what it was doing. And it all seemed to ...
0
votes
0answers
296 views

Get User Login Data (date, time… )

I did my best looking for information about this subject. Your guidance is appreciated. My goal is to perform some actions based on the number of user logins on my website per month and login days ...
0
votes
0answers
230 views

Can't preview custom post - Redirected to home page

When I click on preview in custom post types I get redirected to home page. But when I visit or view the page that have all the Custom posts in I can see all of them. I cant figure out what or why. ...
0
votes
0answers
77 views

How to get dynamic data in page hierarchy?

I'm trying to mimic the page hierarchy rules of WP. I'm checking for the existence of certain files, then requiring them if they exist -- in the same order as I understand the hierarchy rules. Here's ...
0
votes
0answers
44 views

Run function from parent on child site

I'm running a Multisite WordPress installation and have a couple of child sites. I'm trying to run a script from the main page on one of the child sites. It can be a shortcode [pro_display_zone ...
0
votes
0answers
167 views

How to Display Sequential Post Number Count

I know this has been answered at least a couple of times already and there is an answer out there from alchymyth2010 but I am looking for a different solution if possible because I have a fairly big ...
0
votes
0answers
49 views

Wordpress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache

I have been working on a theme for a few days and when I realized my JS file for my theme customizer wasn't updating I decided to clear the cookies and cache, and wow that was problematic. As soon as ...
0
votes
0answers
116 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
0answers
125 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
63 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
0answers
416 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 ...
0
votes
0answers
158 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 ...