Tagged Questions

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

Replace header image on all other pages but home - URL issue

I've got a function working to achieve what I want on my dev server, but it will not work on the live site. I have a random image implemented via shortcode and plugin, and it must appear everywhere ...
1
vote
2answers
69 views

Child Theme files - what is needed?

On child themes: It is stated: ... create a file called style.css. This is the only file required to make a child theme. Then, it states: The correct method to import the parent themes ...
0
votes
0answers
14 views

How to edit plugin to only display on specific post types, instead of all posts and pages

I've installed a plugin (allows users to save favourite posts to a list: http://goo.gl/9LEvjy ) but by default it displays on all posts and pages. I want it to only display only on posts, NOT pages - ...
0
votes
2answers
38 views

How to check if a user exists by a given id

Is there any way to check if a user id exists? I want to create a function similar to username_exists() but which returns if the id exists or not.
0
votes
0answers
37 views

Call wordpress function outside wordpress

I am writing an script to get wordpress posts and user data outside wordpress files and folder, this script run by side of wordpress installation but will fetch data from wordpress as explained below. ...
0
votes
1answer
36 views

AJAX values converted to PHP Variables?

I just started playing with Wordpress and I have a question about the AJAX side of things. I think that I understand how the AJAX front-end to server side processing, back to font-end works. But, I ...
0
votes
1answer
23 views

meaning of (array)function()

I saw this piece of code that have part of the code I never saw before. What is the behavior of (array) in this scenario? so far I know the way of creating arrays in php never see this. // ...
0
votes
0answers
11 views

How to mirror exactly the left admin menu on front end?

Want to mirror the left admin menu on front end, exactly as it appears on backend... I'd like to do this for a multisite so it seems like a seamless transition. I can add more menu items and hide ...
0
votes
2answers
19 views

Adding a filter with custom function to the menu / navigation

I'm going to get crazy with the problem: I want to add a specific css class to the menu items, depending on a custom taxonomy. This is my code so far. add_filter('nav_menu_css_class', ...
0
votes
0answers
52 views

Social Media button function using jquery

I've wrote a fairly small function that I'm trying to get working. At the moment the jquery doesn't seem to have any effect on the html selected. I've checked the "inspect element" all file's are been ...
0
votes
1answer
24 views

Check if excerpt is empty at loop-portfolio

I want to check if excerpt is not empty, then echo the excerpt link, if not the echo permalink, like this: if(the_excerpt()!='') echo the_excerpt(); else echo get_permalink() but how can I check if ...
-1
votes
1answer
29 views

How to assign a div class to a echo function [closed]

How can I assign a CSS (span or div) class to this function, so that I can style the output in my style sheet? function show_today_date() { echo date(get_option('date_format')); } add_shortcode( ...
0
votes
1answer
18 views

add a function to submit options.php

I have a form which does <form method="post" action="options.php"> ......... <input type="submit" class="button-primary" value="<?php _e( 'Save changes', 'bsp_style_settings' ); ?>" ...
0
votes
2answers
37 views

check if the user is owner of current page

I am struggling with this little problem. I have a user profile page and I want to change some of the content based on whether it is my own profile og someone elses. This is my code to add a shortcode ...
0
votes
1answer
27 views

Modify php code to pass a page id as a parameter in order to create a breadcrumb

I use a function to create the breadcrumb in my pages and it works: function the_breadcrumb() { $currentBefore = '<li><a>'; $currentAfter = '</a></li>'; if ( ...
0
votes
1answer
28 views

Load slideshow.css file only if Slideshow is checked / on

I use <?php if ( get_option('mytheme_slider') == 'checked') { get_template_part( 'partials/slider/slider-java-script' ); } ?> to include the slider-java-script.php template part into my site. ...
0
votes
0answers
43 views

Mail function not working with user accounts

I have an issue with the user account system. It refuses to email people their passwords when they make and account and when they get a temporary password. It always returns with this error "The ...
0
votes
1answer
18 views

Open image size links in a page instead of direct image link

I am using this custom function to display image sizes on image.php (attachment page) function my_get_image_size_links() { /* If not viewing an image attachment page, return. */ if ( ...
0
votes
2answers
39 views

Individually styling date month year [closed]

I am using underscore_s barebone theme to build mine and came across this challenge that I would like to style date month and year separately with CSS and the code output puts them together. I dug ...
0
votes
0answers
90 views

admin-ajax.php not working after wordpress 4 update

n WordPress 3.9.2 access to admin-ajax was working for non loggedin users. When I upgraded the script stop working. I have the following code in functions.php function theme_name_scripts() { ...
0
votes
0answers
24 views

Wordpress hook to add content under title or post status buttons on edit.php

I'm looking to add some content above the wp_list_table for a custom post type. I have custom bulk actions and filters but would like to add some further content to this header area. I cant seem to ...
0
votes
0answers
10 views

Splitting of Page

I have opted to go with a single page layout with custom fields. However is becomes tedious to scroll down the page to edit content at end. As such I would like to split the page into smaller parts. ...
0
votes
1answer
88 views

How to target specific wp_nav_menu in function?

I am adding a specific class on my wp_nav_menu link via function.php but I am not able to target a specific menu: This is what I got which targets all wp_menu_nav on my page: function ...
0
votes
0answers
20 views

Get default post thumbnail from custom field

This is default post thumbnail code add_filter( 'post_thumbnail_html', 'my_post_thumbnail_html' ); function my_post_thumbnail_html( $html ) { if ( empty( $html ) ) $html = '<img src="' . ...
0
votes
1answer
31 views

Remove a Plugin function through theme's function.php?

I am using a Plugin called PixGridder for backend setup, but i dont want the front-end css to apply.. I found that in the plugins functions.php has these lines: public function front_styles() { ...
0
votes
0answers
10 views

Let the user duplicate chunk of meta boxes

I have a CPT 'Product', that can be rented or sold multiple times over. Each time a transaction takes place, the admin would like to update some of the information (such as sale date, condition etc). ...
0
votes
2answers
45 views

Calling an custom field from theme option at the frontend

I am having trouble calling a field and displaying its content at the frontend from a custom theme option page. This is the code I am using to display my custom theme option at the backend ...
0
votes
1answer
20 views

Function not pulling image or text from custom post type

//Custom Post Type register_post_type('inf_main_feature', array( 'labels' => array( 'name' => 'Main Featured', 'singular_name' => 'Main Featured', ...
0
votes
1answer
13 views

How to edit label_submit styling?

This is going to sound like an easy fix, but I am looking to style my submit comment button on my comment form. Currently the code in the $args = array looks like this: 'label_submit' => ...
0
votes
1answer
23 views

Function to get the name in database table from the comma separated string

I already created admin column in WP using this code: add_filter('manage_pages_columns', 'page_custom_cols', 10); function page_custom_cols($pages_columns, $post_type) { $pages_columns['user_group'] ...
1
vote
1answer
27 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 ...
0
votes
0answers
40 views

Get Custom Field Value of a $post_id on wp_insert_post Action in functions.php

I have this code in the functions.php file which emails the post content to the admin every time a pending post is added to the database: function send_email_on_pending_post_creation( $post_id ){ ...
0
votes
0answers
11 views

How to format the Widget Display function contents?

I'm writing my first plugin, and basically I'm wondering how to write the code which goes inside of the widget display function: function widget($args, $instance) {} I'm trying to run a post query, ...
0
votes
0answers
53 views

Send post id through ajax and get the post content back

First of all i want to say that I am a WordPress beginner :). I am trying to get a post content in a modal by using ajax. So i send the id through ajax, but i cannot execute the php code anywhere on ...
-1
votes
1answer
28 views

Remove base from the custom post type URL [duplicate]

I wanted to add blog before the post slug in the URL. The URL for the post type page was: http://example.com/blog/post-one So basically to add blog before the posts url in Settings >> permalink ...
0
votes
0answers
34 views

Show custom default avatar instead of gravatar

I'm using this custom function to get the default avatar from my server instead of gravatar: if(!function_exists('custom_avatar')){ function custom_avatar($avatar_defaults){ ...
-2
votes
1answer
33 views

PHP error in shortcode [closed]

Can anyone help me see the error in this code? I'm trying to implement a function via shortcode which I found here: <?php if (function_exists(‘wooslider’)) echo do_shortcode(‘[wooslider ...
0
votes
0answers
31 views

How to create a function to change content in the website?

I've been searching for an answer for over a day, but I couldn't find anything. The problem is that I need to change those 3 blocks of information whenever I want to, using the admin panel I've ...
0
votes
1answer
34 views

apply_filters() function

I have used apply_filters() while retrieving the content from WordPress post like: $content=$query_val->post_content; $content = apply_filters( 'the_content', $content ); When I was using ...
0
votes
1answer
33 views

Function not recognizing page id?

I'm trying to setup an if/then statement so that if the page_id is not one of these three pages or their ancestors, then use the default logo. I'm using the is_tree() function in my functions file and ...
0
votes
1answer
28 views

How do I get thumbnails?

Today I set up my Wordpress blog I used the hueman theme I looked at my posts page And there were blank images with cameras in the middle of them So I guess there thumbnails How do I get them?
0
votes
0answers
22 views

Default options in a theme form

I purchased a theme that allows to choose the layout options when entering a new article from the backend. There are three options: none, right sidebar and left sidebar. As items are added to my ...
1
vote
2answers
83 views

How to mass-delete inline styles in Wordpress custom post type automatically?

I'm looking for a pragmatic way to delete about 100+ individual pages worth of inline styles. I had entered in content for a client by copying and pasting from Word, which took all that data with it ...
0
votes
1answer
29 views

ordering and optimizing functions

Ive been hard at work trying to build some functions to display products on my site. The prices for these products are calculated based on many variables. I think the first set of functions work, ...
0
votes
0answers
26 views

Redirect all users to previous URL before login, except “contributors”

In one hand I redirect all users to previous URL before login. This is the code: function login_redirect( $redirect_to, $request, $user ){ if(isset($_REQUEST['redirect_to'])){ return ...
0
votes
2answers
33 views

Child Theme's Read More Text

I'm sitting here trying to figure out how to change the Read More text. I'm currently creating a Child Theme of Oxygen and as far as I can tell, they don't have a function to easily change it. I want ...
0
votes
0answers
13 views

Changing link output of posts

I'm using the X theme & there is a load-content.php file that uses a function to show recent posts & portfolio items. The code is below; I'm trying to make all links go to a specific page ...
0
votes
2answers
76 views

Count Title and Post Characters

I need to get a total count of characters for post titles and post text characters. Are there any build-in WordPress functions available for that? My posts are paginated so the numbers for post text ...
0
votes
1answer
24 views

Add Function For Instances of Custom Text in Multiple Category IDs to display in post content

I created an extra content file and inserted custom text for a category (and relevant to that category) to display (on a random basis) in all posts belonging to that category and it is all working ...
0
votes
1answer
36 views

Help with a function in a widget

I'm new to custom widgets and functions, and need a bit of help understanding how to achieve something. On my bookstore site I need to display links to books on external site using their ISBN ...