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

saving/reading custom field value does not work - no value gets POSTed

I am trying to add a custom field to all my posts and of course saving/reading the value. As a starting point I took the example from the Wordpress Codex and stripped it down to bare bones. I know it ...
0
votes
1answer
13 views

call_user_func_array() error after moving to another server

I've just moved my WP site from one server to another and my custom post type plugin is causing the following error: Warning: call_user_func_array() expects parameter 1 to be a valid callback, ...
1
vote
2answers
38 views

Hide old attachments from wp media library

I am trying to limit the files that are shown in the wordpress media library popup (from wp_editor). Currently every single file that I have ever uploaded to my site is shown in the library but I ...
4
votes
1answer
123 views

Keep one user logged for a year?

This has got to be simple: how do I keep one user - my-user - logged in for a year? (I'm checking logged in cookies in the dev tools console). Update 8/16/15 This works: add_filter( ...
0
votes
0answers
17 views

Been at this for hours--how do I add a jQuery function in the functions.php of WordPress?

I can't include all the things I need to include in my one multi page gravity forms form. If I try to include too much it just 403 errors me. I need to add a video at the top of each page. I've spent ...
-1
votes
1answer
18 views

Link to external page has wordpress blog-url inside

I am modifying a theme. The initial function looked like that function tmnf_ratingbar() { $rinter = get_post_meta(get_the_ID(), 'tmnf_rating_main', true); if ($rinter > 0) { ...
0
votes
4answers
412 views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
-1
votes
1answer
22 views

WP Members additional fields on user profile

i want to have a limited set of fields during the registration process, but would still like additional fields available for the user to complete in the user profile.these are not required fields. as ...
0
votes
0answers
29 views

WordPress Caching

I try something on my local machine. I have a custom JS and CSS file which I included in the functions.php of my theme (twenty fifteen) like this: function load_my_stuff() { wp_enqueue_script( ...
0
votes
1answer
119 views

AJAX login without a plugin does not work. when add a action to function.php

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: ...
1
vote
1answer
31 views

How does Wordpress process plugin installations?

Please consider that I am not a Wordpress plugin developer, but I am maintaining a lot of Wordpress websites. In case I have to perform a change to all of them, I will have to log in each site and ...
0
votes
0answers
20 views

Declare inline background image in functions.php

I'm not sure if this can be done as I cannot find anything to help me anywhere no matter how hard i try. I'm using Ajax to load to in posts on the press of the button. the posts that are loaded in are ...
0
votes
1answer
54 views

Is the “_s” on this `sprintf(__('Page %s', '_s'), max($paged, $page))` just refer to a text domain?

Is the '_s' value in such code which can be found on Customizing with the filter, just refer to a string of a text domain as what's documented or a literal value? /** * Filters wp_title to print a ...
2
votes
2answers
41 views

Limiting number of custom posts shown on taxonomy page

I am using a custom post type that uses two taxonomies "colour" and "style". I have a script (from this thread) which groups them together so when you are on a colour taxonomy page they are grouped by ...
0
votes
0answers
15 views

How to call the post thumbnails in a list of recent post in wp nav menu?

Thanks to Stack I found a code which allow to list recents posts of each of my categories into my wp nav menu. The code looks like this : // Front end only, don't hack on the settings page if ( ...
3
votes
5answers
3k 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
31 views

Modify category archive page loop on functions.php

I was able to modify the query on the category archive page using global $wp_query; $args = array_merge( $wp_query->query_vars, array( 'tax_query' => array( array( ...
0
votes
0answers
13 views

wp_schedule_event doesn't work

Can someone tell me where I'm going wrong? Images in folder /wp-content/cached_img/ are not delated add_filter( 'cron_schedules', 'cron_add_week4' ); function cron_add_week4( $schedules ) { ...
0
votes
0answers
8 views

Create multiple Instances of Ajax function and Control Variables from Template file

I received some help previously in order to build a Wordpress Ajax Load more function, However the site I am building is using different variances of this on different pages pages. The issue I'm ...
0
votes
0answers
33 views

Template file structure , wordpress hook for altering the template

i need to convert a html structure to theme. So this is my html structure <html> <head> ................. </head> <body> <div class="main"> <div ...
0
votes
0answers
20 views

Wordpress editor problem [closed]

Hi i migrate my test site db to new site using migrate db plugin .Now everything work perfect rather than some pages content not show in editor. But it show in front end and it is in the db also. ...
0
votes
1answer
35 views

Worpress permalink setting

I have a doubt. If book is my custom post type, language is my taxonomy, english is the item in taxonomy , Harrypotter is new post in book with txonomy english. Then how i get the url structure like ...
0
votes
2answers
325 views

Shortcode to find and replace URL

I'm trying to create a shortcode that will search within some specified text for a link and replace it with one that I specify. For example: [scode]Click on <a href="www.X.com">this ...
2
votes
1answer
24 views

Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations

Is it good to add a text domain as an argument to every __(), _e() and __n() gettext call such like these, even though I'm not planing to create my own translations? __( 'Post', 'my-theme' ); _e( ...
1
vote
1answer
948 views

Using PHP to toggle stylesheet and header image, set in cookie

I haven't done a lot of work with cookies or Wordpress before so I think I've been a bit over-optimistic in my quest :p I have created two themes for my site, night and day. I would like the user to ...
0
votes
0answers
23 views

Dynamically generated breadcrumb functions for category.php

BACKGROUND: I want to create a template page (using template.php) for news articles. News articles fall into about 7 different categories (Local, Special Events, Tech, etc). The template will use ...
0
votes
2answers
38 views

Related Posts: Changing Function For Posts Per Page

I am working on dailysuit.de, which features 8 related articles below the content in every post, defined by some tags. Now I wanted to reduce the number of "posts per page" from 8 to 4. Of course, I ...
0
votes
0answers
10 views

shortcode with menu item attributes show only if entered

I have created a shortcode so admins can add a menu with up to 11 items. The issue I have is if they enter only 8 items I have 3 empty items showing up in the html. Is it possible to show items only ...
0
votes
2answers
373 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
1answer
28 views

Function not saving unchecked checkbox

I'm trying to save custom option for taxonomies in wp_options. The following function saves the post id in array if checkbox is checked but when I uncheck the checkbox it doesn't removes term id from ...
2
votes
3answers
453 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 ...
0
votes
1answer
70 views

Extend the WP_Customize_Image_Control class to change its non-frame $button_labels

I'd tried a lot just to change the 'default' button label of a Customize_Image_Control, including copying its class source and re-classname it (*kindly check the non-revised edition for this), and ...
3
votes
1answer
111 views

Automatic Logout on from another active session

I have a made application over Wordpress for premium user where user can see page after logging into his account. but there is issue that same user can login form multiple computer, so I want to make ...
23
votes
4answers
24k 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
3answers
4k views

redirect wp-login.php to another page

I would like to redirect this page wp-login.php to /login page. So when a user clicks on a link like this <a href="/wp-login.php">login</a>, wordpress will redirect him to /register . I ...
1
vote
2answers
57 views

Hide a menu-item and its submenus and display a 'Log in' link if the user is logged out

I need, somehow, to enable that when you logout, that 'My Account' item is getting hidden from the navbar, and instead it displays a 'Log in' link. The item 'My Account' also have submenus with the ...
0
votes
4answers
35 views

Disable wp_is_mobile()

I have a mobile version for my web-site and i used wp_is_mobile(). I will have a button on mobile devices which lets users to switch between the mobile and original versions. Is there a way to disable ...
1
vote
2answers
46 views

Click loads template via ajax

I'm trying to load a template via ajax if the user clicks on a button. This is the code I'm using: On functions.php: function phantom_scripts() { global $child_dir; /* Ajax Requests */ ...
1
vote
2answers
923 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
32 views

The best way to customize “nav-menu-template.php” to add <input> if the 'link_before' is “checkbox”

I would like to add a 'link_before' control for a wp_nav_menu(), like that: if ( strpos( $args->link_before, 'checkbox' ) == true ) { $args->link_before = '<input id="toggle' . ...
0
votes
0answers
12 views

Custom Post Type On Publish Update Meta Field

I'm wondering if someone can shed some light on how I can update a custom meta field value, when a new post is created in a custom post type? Specifically, I have a custom post type named ...
0
votes
1answer
41 views

Are innerHTML elements visible to jQuery functions?

For example, on my admin page i.e. dashboard side: //This is hidden until search results come back //which will be inserted as innerHTML within #searchResults <div id="hideShow"> ...
1
vote
1answer
36 views

How to test for Super Admin

I have the following code in my mu-plugins.php file and the is_super_admin() function does not correctly result in true. I am running v4.2.4 function check_for_superAdmin() { if ( ...
0
votes
0answers
18 views

Adding additional advert after set number of paragraph

I've currently got my website set up where it automatically adds a Google Adsense ad after the 2nd paragraph of any article, but I'd like to improve on this, if anyone is able to help. I'd like to ...
0
votes
0answers
3 views

make a pluign javascript run windows load instead of document ready [migrated]

I have a plugin which is displaying wrapped in a document ready function, but i need to have it wrapped in a window load function. Can this be done using a hook or something? Its getting displayed ...
0
votes
1answer
15 views

Add %taxonmy in worpress custom permalink structure

In default wordpress support %category% tags in custom permalink structure. I need to use %taxonomy in permalink structure .How to do that ? is there any filter are available. Please help.
0
votes
1answer
673 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
0
votes
1answer
40 views

How to insert a single row to WP database table?

Intro: I have a function that handles a contact form variables in my website. user enters name, email and text. function.php gets variables using javascript. I get more information on the user ...
0
votes
1answer
17 views

Add a custom class to the body tag using custom fields

There are certain posts where I want to manually append a custom body class to using custom fields. How do I go about it appending the class to the body tag when a certain custom field is added to a ...
1
vote
1answer
62 views

Bootstrap Drop Down menu is not working

Bootstrap dropdown is working when i added the jquery( https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js ) in footer and by deregistering wodpress default jquery. When i disabling the ...