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)

1
vote
2answers
454 views

Date archives for custom post type

I have seen many questions/posts regarding this, but have yet to find a decent solution. Basically I am trying to do what wp_get_archives does, but for a custom post type (personally I am unsure why ...
0
votes
3answers
2k views

What is the difference between get_page_link and get_permalink functions?

Both functions return permalink to the post or page by it's ID. What are the differences and which of these functions should I use in which cases?
1
vote
2answers
314 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 ...
4
votes
1answer
82 views

wp_set_object_terms and arrays

I need to add a category to about 2500 posts, and either need to use an SQL query or wp_set_object_terms with PHP. I'm looking at wp_set_object_terms so I can add a category and not impact the ...
0
votes
1answer
16 views

My customizer's setting doesn't set to the default and needed to click the control's “Default” button before it'll be set

Here's my sample customizer's setting and control: $wp_customize->add_setting( 'themename_img', array( 'type' => 'theme_mod', 'default' => ...
0
votes
1answer
31 views

Save the outputted image into the Media Library, with a different filename and extension

For example, I have this "/image.php" file in my "/theme-directory": header ('Content-Type: image/png'); $im = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); ...
1
vote
1answer
46 views

Where in PHP do I move title and meta (date) to bottom of each blog section?

I'm working on a Divi site that has two blog grids on the home page. I need to move the title and the date of each blog section to the bottom (below the blog text). <div ...
1
vote
1answer
12 views

Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value

I want to have this kind of validation in my code: if (/*OLD*/get_theme_mod($name) != /*NEW*/get_theme_mod($name)) { // do something.. } That code will execute after pressing the "Save & ...
0
votes
1answer
20 views

How to set default archive image without overriding first attached image?

I have hit a wall. I have archive pages with some posts that have featured images which display fine. Some posts don't have featured images but the first attached image displays. Some posts have no ...
0
votes
0answers
22 views

How To Dequeue Styles From Plugins With “if”

I'm not a coder, but I'm trying hard enough to optimize my site using free codes. Lately, I found a way how to dequeue and deregister script/styles from plugins. Been using this: add_action( ...
0
votes
0answers
26 views

Why wont these thumbnails show up?

Here is a link to the Website with the issue. http://southernhighlands.com/homes/exclusive-listings/ Looking at the 1st thumbnail I can see it is linked to Notice: Removed http:// because I can ...
0
votes
2answers
39 views

White screen error for a custom theme

I have created a theme for one of our clients using bootstrap framework! When i was working on it on Localhost it works Correctly, but when I Uploaded it doesn't work. When I Activate it from ...
0
votes
1answer
27 views

Dynamically generated Navigation Diagram using Custom Fields

I am attempting to dynamically generate a Navigation Diagram (as seen at http://zinderlaw.indigo-grove.com) that uses custom fields on the page to fill in the href tags of the imagemap. I am not ...
3
votes
8answers
6k views

Adding fields to the “Add New User” screen in the dashboard

I'd like to add the field "Company Name" to the add new user page in the admin panel. I've done quite a bit of searching and have been unable to find details on how to do this. I can easily add info ...
0
votes
1answer
66 views

Shortcode display outside the div

I have created a shortcode that retrives and displays a form.The content of the attribute in HTML. function check_my_login( $atts) { return '<form action="" name="" method="post" ...
1
vote
1answer
788 views

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id . I have tried several method . Like get_the_ID() ; ----returns false global $post; ...
0
votes
1answer
21 views

Weird Behaviour: Not all Wordpress Posts appearing

My wordpress posts have vanished on my dashboard but remain in the database? Meaning I have many 404 errors. All (52) | Published (4) | Drafts (7) | Trash (2) TOTAL =11 items (Note how theres only ...
0
votes
1answer
17 views

Published custom posts missing

On my wordpress dashboard I noticed a large number of past posts were missing. All (708) | Published (386) | Drafts (17) | Pending (8) | Private (1) | Trash (3) - Total 412 Our items are custom ...
0
votes
1answer
13 views

Functions when woocommerce isn't installed

I'm working on a theme right now and I'm using some functions like is_shop() in the header if the woocommerce plugin is installed. However when the plugin isn't installed these functions aren't ...
0
votes
0answers
24 views

Split posts into separate screen on custom post type admin screen

I have a custom post type called 'event' that has a meta_key of event_status with a value of either 'upcoming' or 'past' depending on the event date. I am trying to split all past events into their ...
0
votes
1answer
366 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
1answer
42 views

Enabling shortcodes for custom fields

So, in this post it is explained how to supposedly enable shortcodes for custom fields in Wordpress. (Shortcodes are not enabled for custom fields by default.) What I dont understand is where to ...
3
votes
1answer
2k views

How to paginate the get_users function?

Im using the get_users function to show a custom list of users on the site. The only issue Im having a problem figuring out now is how to paginate the result. This is a sample of the function that Im ...
0
votes
1answer
253 views

How can I customize the size of the header of my theme?

I want to change the size of my header using the Sparkling theme. In functions.php, right below this: /** * Implement the Custom Header feature. */ I added this: add_theme_support( ...
0
votes
0answers
28 views

Child Theme functions.php has no effect

I'm trying to make a child theme of Woothemes Appply theme. The Child functions.php file is having no affect though. I started by adding in the code to enqueue a style sheet, which didn't work. Then ...
0
votes
1answer
23 views

Hook into install email

I created a plugin that makes use of the wp_install method (this part is necessary for the plugin to work properly and this function needs to be called). http://wpseek.com/function/wp_install/ ...
1
vote
3answers
47 views

PHP files included in functions.php don't seem to work

This is my first post on WordPress StackExchange, I'll try to be precise. My question is: Is there anything in particular I should do to the files I'm including in my theme's functions.php file? ...
1
vote
4answers
1k 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.
2
votes
1answer
32 views

Keep a fluid max number of posts on site

I'm trying to figure out how to set the max number of posts allowed across the site, but keep it fluid by sending old posts to the bin when a new post is over the limit. (I'm trying to stop the ...
0
votes
1answer
123 views

Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS

I've been having trouble Automatically Compiling my .scss files into my main WordPress style.css file. I'm using Leafo's SCSSPHP script and trying to achieve a few things. i'm using Kirki ...
1
vote
1answer
51 views

Programmatically set page template based on page ID

How would I set the page template based on the ID? I have Redux Framework installed in my site and one of the options is to set a registration page. On this page, I want to use a specific template, ...
0
votes
2answers
39 views

esc_url( ) won't use https

The code on the page looks like this: if ( ! empty( $image ) ) : ?> <div class="headshot"> <img src="<?php echo esc_url( $image ); ?>" alt="Photo of <?php echo esc_attr( ...
0
votes
0answers
15 views

I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views

This is my Ajax Handler function function get_total_post(user_ID) { jQuery.ajax({ type: 'post', url: ajaxforall.ajaxurl, cache: false, data: { action: ...
1
vote
1answer
138 views

How do I add Bootstrap and LESS to my migrated WordPress site?

I'm migrating a website to WordPress - it uses both Bootstrap and LESS. I found a snippet online for enabling Bootstrap and the outputted CSS via functions.php: function theme_add_bootstrap() { ...
0
votes
0answers
19 views

Cannot disable wpauto

I have tried everything to disable something adding multiple paragraph and break tags (up to 20 in a row) tags to a registration form. I first went into the event espresso files for this plugin and ...
0
votes
0answers
22 views

Adding some sort of Label-text to a looped button

To sum up my problem, here's a picture: I've added this text with a hover-fx to a button to explain to users what the button does. I've done so by adding a <div> with another <a>-element ...
0
votes
0answers
15 views

Manually call a WP class, e.g. wp-comments-list-table?

How would I output a class such as the admin comments table (wp-comments-list-table.php) on my own page? Thanks in advance
2
votes
1answer
46 views

Setting cookies in Wordpress

I am trying to set a cookie on my site and wanna switch the style sheets using this cookie. I've tested a normal function but it does not work. I've put below code into my functions.php ...
0
votes
1answer
49 views

Change Slug of a Custom Post Type

I use a plugin that creates a custom post type with a slug that I am wanting to change. I don't want to overwrite the plugin files, so I'm wondering how I can change the slug using a separate ...
0
votes
0answers
57 views

Setting a cookie in functions.php and it gets deleted when working on an other function

My first function gets the parameters from the URL and sets the cookies: /** Get variables from the URL and set them into the coockie **/ add_action( 'init', 'set_utm_cookie'); function ...
0
votes
0answers
25 views

Using Conditional Themes to change out different themes using the Theme Customizer radio Buttons

I've been trying to change my theme based upon a radio button selection from the theme Customizer. I've included this plugin -> https://wordpress.org/support/plugin/wp-conditional-themes as a file ...
0
votes
1answer
91 views

How to pass variables from a function in functions.php to an other one

I have a function that gets the variables from the URL (UTM): /** Get Parameters From UTM **/ add_action('template_redirect', 'get_the_utm_vars'); // 'template_redirect' - action hook that ...
1
vote
0answers
45 views

mysql_real_escape_string() vs. esc_sql() in WordPress

Does mysql_real_escape_string() and esc_sql() in WordPress both do the same thing? I tried the following: $fetch_row='<p>And again for single posts</p>' echo mysql_real_escape_string( ...
1
vote
1answer
95 views

How to use get_media_embedded_in_content function

I am trying to figure out how to use this new WordPress function. get_media_embedded_in_content (string $content); The documentation says, "a string that might contain media data" but that is too ...
0
votes
2answers
45 views

Difference b/w Simple function call & do_action call

dear I unable to understand of simple function call & do_action function call. do_action: I hook function and I place this in my one template file for use in header template. ...
0
votes
1answer
20 views

Problem with add_rewrite_tag

I tried to rewrite my URl with a custom query string. Here is the code : add_action( 'init', 'wpse12065_init' ); function wpse12065_init() { add_rewrite_rule( ...
1
vote
1answer
67 views

Set first oembed in post to a global variable or function

I have a function that gets the first oembed in the post. I got the code from this related post. add_filter('embed_oembed_html', 'my_function',10,4); function my_function( $cache, $url, $attr, ...
0
votes
1answer
34 views

Hide certain post types from editors

I'm trying to hide a series of posts from my editors in the admin panel based on either custom post type or category (whichever is easiest). I tried adding a function such as: add_action( ...
0
votes
2answers
39 views

same user role or copy the user role to be same as the other role

how do you make the user role "contributor" to be same as the user role "seller" by using functions.php I've tried user role editor, but it seems to be the dokan multivendor plugin has set only into ...
0
votes
0answers
38 views

Removing all child categories from Yoast SEO breadcrumbs (or Navxt)

I am making a wordpress site and have ran into some trouble regarding the breadcrumb on single pages. At the moment it outputs Home > Parent category > Child category > Post title. This is usually ...