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.
2
votes
1answer
222 views
Generate Advanced Custom Fields box in custom admin menu page
I have created an custom admin menu page called FCC Youtube with add_menu_page function
which has some custom fields I manually generated via HTML and PHP:
code ( just the part how I created this ...
2
votes
1answer
72 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
117 views
Post thumbnail relative link and HTML modify
I want to remove the website url from all the_post_thumbnail() so they become relative and remove/add attributes from the output.
So far I got the following code added to functions.php of the theme, ...
1
vote
1answer
25 views
Force authors to Preview a post before publishing
I'm looking to find a way to force authors (including admin & editors) to preview their post before publishing. Is this possible, if so does anyone know the easiest way to achieve this?
I'm ...
1
vote
1answer
39 views
media resize/crop possibilities?
Under admin panel -> media settings
there are no minimal width option for thumb or other image modes
ex: I would like to crop image widthout distortion ->
height 124px and minimum-width 124px and ...
1
vote
1answer
79 views
Gravity Forms field entries into wp_query loop
I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)...
add_action("gform_after_submission_18", "set_post_content", 10, ...
1
vote
1answer
130 views
Using plugin functionality in external php script not working
I am encountering a strange problem which I couldn't solve so far.
I'm calling a .php script via cronjob (Debian/GNU Linux).
To use wordpress functionailty I added:
define('WP_USE_THEMES', false);
...
1
vote
1answer
52 views
Post meta not updating
I am trying to make a voting system for WordPress.
This is my code in functions.php:
add_action("wp_ajax_add_votes_options", "add_votes_options");
add_action("wp_ajax_nopriv_add_votes_options", ...
1
vote
1answer
2k 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
47 views
Want to be able to sign up subscribers as authors
I want to be able to select a subscriber an author of a post in the admin so it displays their name as having written the post, but I do not want to give them any additional privileges (if they login ...
1
vote
1answer
229 views
edit role display name and label name without plugins
I'am creating WordPress function for editing role name
function change_role_name($role_name, $new_role_name, $display_name) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles ...
1
vote
1answer
42 views
Run wp_kses_decode_entities on atom feed?
I would like to convert the htmlentities in only my atom feed to their corresponding characters.
Using the below in my functions.php I've gotten close, but obviously the commented out line doesn't ...
1
vote
1answer
264 views
Update user meta of author when post content is viewed
I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it ...
1
vote
1answer
149 views
Removing permalink from post thumb in twentyeleven
possibly a simple thing to do but I'm not sure how it's done - I want to remove the permalink from a post thumb, in the default twentyeleven theme. Looked through content.php and the other templates ...
0
votes
1answer
12 views
Display post x of y within category
I'm currently using this class in my single blog posts to get a total post count and number my posts (post 89 of 90, etc...)
class MY_Post_Numbers {
private $count = 0;
private $posts = array();
...
0
votes
1answer
14 views
Call a function with href
Is there any way to call a function inside plugin with <a href='plugin-function'> tag? I need this to show user details which will not be bound to any action hook.
0
votes
1answer
24 views
More link - not text
I am using origin theme. This theme writes dots in post end. In functions.php file I saw line with text:
function origin_excerpt_more( $more ) {
return '...';
I changed text to More... and ...
0
votes
1answer
26 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
22 views
resizing of thumbnails not working
i have the following in my functions file from the wordpress codex
<?php add_filter('show_admin_bar', '__return_false');
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( ...
0
votes
1answer
45 views
How Do I include/Import a Custom Widget from the Parent theme into My Child Theme?
I'm trying to make a small modification to a custom widget that was included with a clients parent theme.
Whenever I remove the parents version of the widget (for testing purposes) the child version ...
0
votes
1answer
19 views
Wordpress Theme Update Action?
I've done quite a bit of searching. I'm looking for hook/action called after a theme update. I know the initialization one - but a basic update? Cannot seem to find.
If one does not exist, how can ...
0
votes
1answer
22 views
Adding Categories Through Function
I am creating a template theme for WP and am wondering if there is a way of the theme adding new categories to the db, through the functions.php upon activation of the theme.
It seems like a fairly ...
0
votes
1answer
36 views
WordPress Check User Role Function (multiple roles)?
I'm playing around with the check_user_role function put together by AppThemes; as mentioned in the WordPress current_user_can codex page. In the AppThemes tutorial code it references the following:
...
0
votes
1answer
17 views
One button to change all settings in theme customizer?
I have been attempting to create a theme reset button for the theme customizer that automatically removes all of the theme_mod settings. I have tried multiple ways to do this and have never been able ...
0
votes
1answer
54 views
Requires PHP version 5.3.0
When I try to install "Background Manager" plugin I am getting this error "The plugin "Background Manager" requires PHP version 5.3.0 or better, but version 5.2.17 was detected". Could anyone suggest ...
0
votes
1answer
56 views
Search Woocommerce product titles only
Limiting post search to titles only is a breeze, but WooCommerce's post types don't abide by this rule. I have tried modifying the code below to be specific to products but am not having any luck.
...
0
votes
1answer
25 views
Showing custom post type categories in the menu
here is my custom post type and category:
//Register nav
register_nav_menus( array(
'main_nav' => 'Main navigation'
) );
//Custom post types
add_action( 'init', 'create_post_type' );
function ...
0
votes
1answer
48 views
How to autopopulate the Advanced Custom Fields from the submitted form data?
I use this code in the functions.php to autocreate a post after a form has been submitted:
<?php
add_action('iphorm_post_process_1', 'mytheme_create_wp_post', 10, 1);
function ...
0
votes
1answer
21 views
Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username
When a moderator/admin leaves a comment I want them to stand out and not be like any other comment. I have this piece of code so far but I dont think will do any good
<?php $current_user_is_a_mod ...
0
votes
0answers
30 views
Current path on page in functions.php
How can I get the current path of my page?
I know how to do it inside a template file, but I need it inside functions.php.
And it has to be before the send_headers hook, because I'll use this info to ...
0
votes
0answers
34 views
Create custom permalinks / rewrite
How can create a custom permalink in my functions file that would include a template page
when you go to a custom url: http://example.com/members/settings
I have a template page at ...
0
votes
0answers
37 views
Registration Fail Redirect Problem
We use two registration links allowing users to register for different roles:
/wp-login.php?action=register&utype=subscriber
/wp-login.php?action=register&utype=contributer
The subscriber ...
0
votes
0answers
32 views
previous_post_link() : Within all categories except one
According to this tutorial if I want to display link to previous post in the same category, I can use the following code:
<?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ...
0
votes
0answers
45 views
Customize wp-caption output
I'd like to customize the output for the wp-caption shortcode. I need to put the attachment full-size URL wp_get_attachment_image_src($post->ID, 'full')
function custom_img_caption_shortcode( $a , ...
0
votes
0answers
42 views
Wordpress redirect after update profile not saving?
Im using the following code to redirect a user after they update their profile but its not saving any changes that are made (including custom user meta fields).. Any clues? Thanks!
add_action( ...
0
votes
0answers
31 views
Figure element with multiple image short code
I have a short code I developed that goes like this:
[figure description=""]
[image src="" title=""][/image]
[image src="" title=""][/image]
[image src="" title=""][/image]
[/figure]
What it does ...
0
votes
0answers
42 views
Updating user_meta from pop-up form in back-end
I have created a custom wordpress backend area, which lists out all members on my wordpress site. Currently, there is a point system involved for loyalty rewards, which is maintained in this back-end ...
0
votes
0answers
52 views
How to execute a function from function.php in a javascript?
I have created a custom menu function in functions.php, but I need to execute it in a container that is created by a javascript. Is this doable? The js is outputting a container called ...
0
votes
0answers
73 views
Adding a check box and a link to terms and conditions on registration page?
I found this code online, but it's for the login page. I tried changing the word "login" to register and noticed that it appeared on the registration page; however it didn't need to be checked off to ...
0
votes
0answers
42 views
Change image links via functions.php
I have seen many functions that auto add a class or "Rel=" to an image, what I want is something similar.
I hope someone can help me do this function, I would like to automatically (via ...
0
votes
0answers
28 views
Using _e() function and file.po
I want to translate some phrases in my wordpress template, and I use es_ES.po to translate from english to spanish with _e() function. Works fine but the question I have is:
Is there any way to ...
0
votes
0answers
20 views
Hide posts by a category and when it's the only one
Using the following script in functions.php you can hide a certain category on the home page. In this case the category with id 5.
function exclude_category($query) {
if ( $query->is_home() ) ...
0
votes
0answers
27 views
Widget options disappear when dragged to widget areas
When dragging a widget to a sidebar, it gets added, the throbber spins for a second and then all of the options within the widget disappear. So, the frame for the widget is there, but it's just empty. ...
0
votes
0answers
32 views
Check Types custom checkbox and metadata when publish post
I´m using Types to create metaboxes with custom checkboxes to make some custom functions. The problem I have is with this function I created:
function check_zone_tag(){
$postid = get_the_ID();
...
0
votes
0answers
27 views
Only allow customize partial of the email address when register / edit in the user profile
I can not find a fitting answer online, so I need to see all the pros in here for a favor.
I am thinking about only allow user to edit partial of the email address when register, but I do not know if ...
0
votes
0answers
40 views
How to create a shortcode that lists products by category
Hi I d like to create a shortcode that lists products of a certain category.
I ve used the following code to register products and categories:
add_action('init', 'catalog_init');
function ...
0
votes
0answers
34 views
How to change all titles of a specific category?
I want to change all titles of posts from a specific category to a static one and don't want to change the rest.
I have tried this code (based on this question but it doesn't work:
...
0
votes
0answers
44 views
Google Custom Search Engine
I followed instructions on below link and Google Custom Search Engine does not seem to be working on IE and Safari. Is there something wrong with the Genesis with Google CSE or is this something that ...
0
votes
0answers
34 views
header.php link not showing on initial login
In our header.php file we have two links that only show if a user is logged in - a 'Music upload' link and a 'View your page' link. Once the user logs in the music upload link shows fine but the ...
-2
votes
0answers
25 views
Dashboard Calendar
Any body happen to know how I can accomplish an Admin Dashboard Calendar? Calendar that displays on the dashboard when a user loggs in? It can be a plugin and I love diving into code... Any ...

