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

Getting URL of archive (category) page

I'm trying to retrieve the current URL of the page, which works everywhere except for archive pages, for example, a category page. On a category page, it shows as the most recent post in that ...
0
votes
1answer
17 views

Query function not executed between <div> element

I'm wondering why the following code is not executed between the element it's put in. I know sort of how to fix, but I'm not sure if that's the best solution. My code: First function function ...
1
vote
1answer
26 views

What's the point of using Wordpress's built in admin-ajax.php?

I'm trying to understand why using admin-ajax.php is advantageous over doing something like this: add_action ('wp_loaded', 'my_ajax'); function my_ajax() { // Do Ajax, Check $_POST die(); } ...
0
votes
2answers
12 views

Wordpress - registering sidebar and adding a button directly after .textwidget

I have registered a new widget area, code as below and want to add a button after the .textwidget, however cannot seem to do it properly. Adding it after the </li> results in the button not ...
0
votes
1answer
35 views

What exactly do this function declared into functions.php file of a WP theme?

someone can help me to understand what exactly do this function declared into the functions.php file of a theme? function exclude_featured_tag( $query ) { if ( $query->is_home() && ...
0
votes
1answer
10 views

update_usermeta don't work

When I return in the function $setfound, I become a white screen and when I return $setlink, it works fine. function editsteamlink(){ $setlink = $_POST['steamlink']."/?xml=1"; $setresponse = ...
0
votes
2answers
23 views

jQuery HoverIntent is not a function

I am working on a site that uses jQuery for a number of functions but I am having a repeating error: hoverIntent is not a function I have referenced similar questions on this forum and they ...
0
votes
1answer
18 views

is_dynamic_sidebar always returns true while using Jetpack visibility

If I have any widgets in the sidebar, even if the jetpack visibility is set to not show on that page, is_dynamic_sidebar return true. Here's the code in my theme functions file: add_action( 'init', ...
0
votes
0answers
7 views

Creating multiple functions for front-end forms

I have the following situation (which I simplified for didactical purposes): page-books.php: <form> <input type="text" name="title" /> <input type="text" name="sinopsis" /> ...
0
votes
0answers
16 views

Different Name and Email for wp_mail_from and wp_mail_from_name

I want to make the email and Name dynamic.Everything works fine.But I can't able to get the name and email for each doctors.I have attached my code which I have tried.please help Thanks in Advance. ...
0
votes
1answer
27 views

get_post_meta not working inside a function in functions.php but works outside

function notify_new_posts($post_id) { $keyval = get_post_meta( $post_id); $buyer_wdistance = get_post_meta( $post_id, 'cf_wdrive'); //$buyer_wdistance = $keyval['cf_wdrive'][0]; ...
0
votes
1answer
30 views

Replace admin header logo with an image

I want to replace the default WordPress admin bar logo to my custom logo which is a PNG file. I have tried a code it's not working. function custom_logo_admin_header() { echo ' <style ...
1
vote
1answer
30 views

How to add a class to the attachment images

When I'm in the Wordpress editor and I add an external image with the 'img' button, my html result wil be like this: <img src="http://example.com/image.jpg" alt="image" /> How can ...
0
votes
0answers
12 views

Plugin to encrypt url in base64 [closed]

hello friends hope to help with this plugin created for decoding base64 urls ... The problem is that encrypts urls. I hope I can help change it. <?php /* Plugin Name: Links Plugin ...
0
votes
0answers
13 views

Move Custom Fields on General Settings Page to New Location

I've created some custom fields on the General Settings page after studying up on this post: Add multiple custom fields to the general settings page. I'd really like to move them to their own ...
0
votes
1answer
39 views

Display WordPress Search

I am trying to display the current WordPress search term on single.php, index.php, and category.php...basically when someone searches for something I'd like WordPress to remember what the last search ...
0
votes
0answers
8 views

Getting categories from DataBase & WP Favorite Post

I am trying to create a shortcode that pull the most saved posts (using WP Favorite Post) and displaying them by YEAR, MONTH or CATEGORY. So far I have been able to get the year and month working ...
1
vote
1answer
25 views

Child theme within a child theme?

I'm developing a child theme, but also want to make it possible for that child theme to have a custom functions.php file that won't be overwritten during theme updates .. is this possible in any ...
1
vote
1answer
49 views

Edit tag cloud widget number

By default, the WordPress tag cloud widget has a set amount of 45 tags to display. This can be seen in the wp-includes/category-template.php file. By default, the WooCommerce plugin which I have ...
0
votes
1answer
14 views

Get all categories of custom post even not assigned

I know how to get all categories with get_categories and name custom taxonomy name, but wordpress only shows those categories those are assigned to a post. Those which are created, but not assigned, ...
0
votes
1answer
26 views

Can't get link if there is no post available

I have a function which creates a link for the taxonomy term , with the selection of post_type. function get_custom_term_link( $term, $taxonomy, $post_type ){ $link = get_term_link( $term, ...
0
votes
1answer
46 views

Passing postid of Testimonial Custom Post in Shortcode Parameter

I am trying to create Testimonial custom post and display using shortcode function create_post_type() { register_post_type( 'testimonials',//new post type array( ...
0
votes
0answers
17 views

Why does `url_to_postid` return 0 when testing `page_for_posts` Page?

If I set Reading Settings > Posts Page (in other words, the page_for_posts option) to a static page, and then attempt to pass its URL through url_to_postid() it will return 0 - why is it? I ...
0
votes
0answers
7 views

Add a excerpt to a custom WYSIWYG

I have a secondary WYSIWG on my post and I am using it to display content under a thumbnail. I am trying to figure out how to limit the amount of words I can display with the code I am using to ...
0
votes
2answers
41 views

Do we have to use ftp to recover from a bad functions.php edit?

Just tried to make an edit to the functions.php on my site. As is often the case, wp didn't like it and threw a fit, locking me out of making any further changes. So now I have to use ftp to edit out ...
0
votes
1answer
38 views

Creating wordpress user registration form

I am having a form page called Test Form with this form : <div id="container"> <form action="wp-content/themes/max-magazine/TestForm.php" method="post" name="myForm"> User <input ...
2
votes
2answers
42 views

Calculate percentage of post by category

Is it possible to calculate the percentage of posts in each given category? I'd like to make a bar chart to visualize the amout of posts in those categories. I thought what one needs would be the ...
0
votes
0answers
17 views

add classes to wordpress menu links

As the title already says, I am trying to add classes on the WordPress menu item links (so not the li, but the a element). If it is possible to achieve something similar to WordPress its own function ...
0
votes
1answer
13 views

Get category id for a custom category and display it in a class

I am having trouble displaying my custom category ID to my li ID. The code I am using below is displaying the post ID of the post category instead of the custom category. What I am trying to do is ...
0
votes
0answers
10 views

Meta description ellipsis [duplicate]

I have a function that puts a meta description in my theme's <head>. It works well but I have a small issue. It just cuts off words in the description once it reaches the 160 character limit. I ...
0
votes
1answer
17 views

Hide a div when a custom field is empty

I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg ...
0
votes
0answers
25 views

Custom function won't work in JS but human_time_diff() will [closed]

I have a function the_rooms() defined as: function the_rooms() { $latteParams['post'] = WpLatte::createPostEntity( $GLOBALS['wp_query']->post, array( 'meta' => ...
0
votes
1answer
35 views

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more ...
1
vote
0answers
32 views

wp-comments-post.php file returns a blank page

When i post a reply to my blog, it's return a blank page to me. It seems that happens because of this code in wp-comments-post.php if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { header('Allow: ...
0
votes
0answers
16 views

Shortcode to get child pages of multiple parents (using parent slug)

I'm using a nice shortcode to get the child pages of a specific page, using just the parent page slug. [getChild name="page-slug"] This is done using this code: function getChild_function($atts){ ...
0
votes
0answers
10 views

Password Protected Page Redirects To Dashboard on Submit

I am trying to use the built in post/page password protection feature on Wordpress 3.4. However, on the password protected page when you click submit, you are taken to the wp-login page or dashboard, ...
0
votes
0answers
18 views

Merge / Combine two php functions for Previous and Next Link with Thumbnail

I will wrap two merged php funtions in one div container - so i have only one php function and one link to the next post, regardless if someone clicks on the thumb or the text part. These are the two ...
0
votes
1answer
31 views

How to add 'data-caption' inside an anchor tag

bellow is custom gallery code. function custom_gallery_shortcode( $attr = array(), $content = '' ) { $attr['itemtag'] = "li"; $attr['icontag'] = ""; ...
0
votes
0answers
18 views

wp_mail recipient

I am new at this and seeking help, I'm really need a light at the end of the tunnel, so if you can help me, please do it! I will be very grateful! The question is, what do I do to when someone fills ...
0
votes
0answers
17 views

Proper use of add_option() function?

I would like to add a variable to my site's database. I used add_option() to do that, but it's not working somewhy properly. Probably it does not save the option. my code is: $heatall3 = '10000'; ...
0
votes
2answers
20 views

Pagination custom query

I am trying to make a custom page template that shows the most viewed posts. I can return posts but I am having trouble figuring out how to paginate it. Here is what I have: $args = array('orderby' ...
0
votes
0answers
18 views

Add Class to Tag Cloud Links and Change Terminology

Is there a way to use functions.php to add a class name to all the tag cloud links? This topic does what I need, but it's not through the functions.php file. I was also hoping to change the tag cloud ...
0
votes
0answers
14 views

Countdown to post date tag function?

I made an events post type and I wanna make countdown to post date, for example: Let's say the post is due 5 days later so it writes in the post '5 days remaining' Any suggestions?
0
votes
0answers
8 views

Rewrite rules for subterms in custom taxonomies

I am using a large number of custom taxonomies. My post type is called "location" and there is a parent term "Asia" and a subterm "Thailand". Now I created the taxonomy archive template files ...
-1
votes
1answer
27 views

How to display login form anywhere, when user isn't logged in, without redirecting?

I'm currently using Theme My Login, and I'm building a membership website where nothing is accessible to anyone, unless they're logged in. When a user, who isn't logged in, enters anywhere on the ...
0
votes
2answers
31 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
0
votes
0answers
13 views

Show the online status of the current post's author

Is there a way that I can show the online status (Either online or offline) of the author of the post that a site visitor is viewing? I imagine it's something to do with the Transients API ...
0
votes
2answers
26 views

Overriding methods in a child theme

Guided by the Codex doc on Child Themes I have created a twentythirteen-child theme for my website by copying the unchanged index.php file from the parent theme and by creating this simple style.css ...
0
votes
0answers
17 views

Load mutiple stylesheets inside one IE condition

I want to load Load mutiple stylesheets inside one condition for Internet Explorer: wp_enqueue_style('ie-style', get_template_directory_uri() . '/style-ie.css'); wp_enqueue_style('ie', ...
0
votes
0answers
14 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...