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
0answers
4 views

Custom Fields: Linking a thumbnail to another image

I'm trying to figure a way to link a project, not to another page, but rather to an image that I'll eventually display in a lightbox but for now, it just links to the image in its' own window. That's ...
0
votes
0answers
14 views

need help with '… read more' excerpt in functions.php

I have this to generate the link: <a class="view-article" href="' . get_permalink($post->ID) . '">' . __('View Article', 'html5blank') . '</a>'; But I don't want it to open the post ...
0
votes
1answer
25 views

Function that prevents users from uploading photos more photos

Mjello, I'm struggling with this function that prevents users from uploading more photos than what their membership are entitled to. So they have 10 photos to upload. When they've reached 0 they ...
1
vote
1answer
795 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
2answers
31 views

replacing words to “…” [on hold]

So, I have this post title that has a certain length (say 15 words). When the browser width is reduced, the overflown words are placed to a next line by pushing everything down. However, is there a ...
0
votes
1answer
31 views

Call function without having to wait on response

When submitting a form I want to call an additional function that will connect to a webservice. Because of the slow response time of that webservice, I don't want the page to keep loading untill the ...
0
votes
1answer
325 views

Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct ...
1
vote
3answers
311 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
1answer
16 views

Excerpt function for any content

Is there an excerpt output function in wordpress I can hook into regardless of the field used, rather than just the main content field? I have a CPT using custom fields, and rather than creating a ...
0
votes
0answers
6 views

Overwriting shared image on Facebook to Yoast image

I am facing issues with facebook images only sharing sometimes with the API. I have done some research and it seems it has to do with a bug by Facebook and https images. ...
1
vote
1answer
2k views

How to create TEMPORARY Download links in a wordpress POST?

I'm creating a WordPress blog with some members-only page. In those members-only posts I have my own tutorial download links which i have uploaded for FREE. Problem is I want them to stop sharing the ...
0
votes
1answer
21 views

Problem in shortcode outputting content

I`m trying to make a shortcode that output the a div containing content from Custom Post type . I'm able to output the content but content does not output within div . the shortcode output the div and ...
0
votes
1answer
14 views

Extract and display user infromation on an automatically created page

Is there a way to get the block of code below to extract a list of given user information as it creates the page for the new user. It creates new page for new user as supposed but I'd like it to alos ...
0
votes
1answer
25 views

How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [on hold]

I am modifying someone's Wordpress theme and they have a section for upcoming tour dates. The page for inputting was made with Advanced Custom fields plugin and uses a date picker widget that stores ...
0
votes
1answer
15 views

How to convert raw url to hyperlink?

I have a custom field with raw urls and I want to convert them to hyperlinks. So I used this code: <?php $text = get_post_meta( get_the_ID(), 'Links', TRUE ); echo make_clickable( $text ); ?> ...
0
votes
3answers
56 views

Dequeue script to prevent javascript event conflict on wordpress child theme

I've built a child theme of Divi Theme to use with Buddypress. So far so good, except for a script conflict on commenting buttons. The theme load a javascript (js/custom.js at 2642:2662) with the ...
0
votes
1answer
15 views

Adding Item and Coupon Programmically via WooCommerce [on hold]

Since WooCommerce updated to 2.3, my previous function is not working for adding a coupon and an item, if an item already exists in the cart. function add_product_to_cart() { if (!is_admin()) { ...
2
votes
3answers
2k views

Add class to menu items of one specific menu (nav_menu_css_class)

This code adds an extra class to all my menu items: add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2); function special_nav_class($classes, $item){ $classes[] = 'btn'; return ...
1
vote
1answer
430 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
-4
votes
1answer
1k views

How I can show short content with short tag

I am using Wordpress and I want to show ** short content with limit ** of words for every post on home page and for this I am using this code functions.php function abc_the_content($num_words) { ...
0
votes
1answer
13 views

Randomize Color Scheme Selection in Theme

on my site I'm using cenetric, a child theme of genesis and this theme comes with some predefined color schemes. //* Add support for additional color style options add_theme_support( ...
0
votes
1answer
31 views

Insert function insde body tag

How to insert this function inside <body> <?php function Ciusan_NBar(){ global $options; $options = get_option('Ciusan_NBar'); if($options['CNB_Showing']=='yes'){ ?> <div ...
0
votes
1answer
34 views

Is there any wordpress function to update a random post every 10 minutes?

I' m looking for a function which can be inserted in wordpress theme function.php , when inserted , i want it to update a random post (which is already posted ) every 10 minutes . can this be done ...
0
votes
0answers
14 views

stop run function every time

Hello I write Following function in my Custom plugin. But when Every time I open my website this function running . I don't want running when open website, I want to run manual Plugin Name: ...
1
vote
1answer
478 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 ...
0
votes
1answer
59 views

How to build shortcode for tabs

i made a tabbed widget to display recent post , comments, and popular posts, but now i want to take out tab function from this and make a shortcode of it, so i can add it to wp posts and use it there. ...
2
votes
2answers
359 views

How to customize the_archive_title()?

In my child theme's archive.php, I have the following code for displaying the title of my archive pages: <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ...
1
vote
1answer
27 views

Remove “Category:”, “Tag:”, “Author:” from the_archive_title

I have the following code in my theme's archive.php: <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> This gives me titles like "Category: Russia", "Tag: ...
0
votes
1answer
10 views

Excerpt for pages not showing

I am creating a simple wordpress theme and need excerpts for pages. I have tried the code from many topics some resolved on 'wordpress SO' but nothing works. Because I created the theme from scratch ...
0
votes
0answers
31 views

Restrict Editing by Category

I've tried every possible user role plugin for this, but each of them no longer work with the latest edition of Wordpress (Role Scraper, Restrict Categories, Advanced Access Manager, etc). If a plugin ...
0
votes
1answer
17 views

Emailing Authors When Post Is Published

I have gotten the code to do this. However the theme I am working with does not save emails the authors input on the front end into the normal wordpress email. It instead saves it in a variable. ...
0
votes
2answers
179 views

Possible to register multiple custom taxonomies in one function?

I'm registering 7 custom taxonomies in my functions.php. Since each function uses the same labels and arguments and is attached to the same Custom Post Type, I'm wondering if it's possible to register ...
0
votes
0answers
19 views

Custom function to add a secondary logo

I'm looking to create a custom function in order to be able to change/load a new image from the "customize" panel (this because I won't be the one who manage the website, so I'm trying to made things ...
0
votes
1answer
366 views

Change custom post type slug from plugin options

I'd like to give users the option to change a custom post type slug in my plugin. Using this answer, I'm able to hardcode it into a function: Redeclare/Change Slug of a Plugin's Custom Post Type ...
0
votes
0answers
11 views

Rotate image media item 90° anti/clockwise ajax front end function?

Is there a rotate image function that I can create a button on the front end of my website, using ajax inconjuction with the id number of the media item? I'm thinking having 2 buttons, rotate left ...
0
votes
0answers
38 views

Edit, Add or unset woocommerce user meta fields in the admin panel [closed]

I used the following filters and hooks (add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' ); ...
0
votes
2answers
20 views

Assign category a default post type

This one has been bothering me for a few days now, so I'd really appreciate any help you can give me. Problem overview: I have a plugin which automatically creates a post and assigns the category ...
0
votes
1answer
30 views

Shortcode to get featured image of specific id post

So I'm trying to create a shortcode to get specific id and its featured image to display it in a specific page. I want to use shortcode to make it easier for the user to add any post in this page. ...
1
vote
1answer
919 views

Remove wp-mediaelement.css from wp_head

I´m customizing the new core audio/video player via CSS in my styles.css. I tried to remove the wp-mediaelement.css with the following code in functions.php, because I don´t need it anymore. function ...
0
votes
0answers
25 views

Modify shortcode to work with custom taxonomies and slugs

I am using this code which works fine with posts but I am looking to modify it so that the user can specify in the shortcode: custom post type name taxonomy name slug of taxonomy category For some ...
0
votes
1answer
82 views

Calling the first & last post by category in custom post type

I have custom post type for comics, called “comic” and have written a basic comic navigation. First —previous — (current) title — next — and last comic. In functions.php, this code calls for the ...
2
votes
1answer
509 views

Remote upload file to server B

I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try. Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send ...
0
votes
0answers
26 views

Override A Plugin Variable And Function Via Functions.php

Is it possible to override a variable in a plugin function without altering the plugin? The closest thread I found to answer this problem is this one : Pass A Value From Outside To A Plugin Variable ...
0
votes
1answer
351 views

Session is not starting

I've read the usage of session() in WordPress from here and here. And I placed the following code into the very starting of my functions.php: /** * ENABLING SESSION TO THE SITE * Thanks: Shazzad ...
1
vote
1answer
2k views

Set posts of a custom post type to be private by default?

Say I created a custom post type called 'Private Posts' ($post_type = itsme_private_posts) and want all posts under the custom post type to be set to 'Private' automatically when published i.e. by ...
0
votes
1answer
51 views

Fatal error: Call to undefined function add_action() - an untouched problem

The question was asked many times in many ways, but unfortunately is not covered well in most of the answers. I'm having the same issue doing things using include-files. In my TwentyFourteen child ...
0
votes
1answer
1k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
1answer
31 views

Adding New Role

I have add new role in functions.php file by this code: // Add a custom user role $result = add_role( 'supplier_for_planvent', __( 'Supplier_For_Planavent' ), array( 'read' => true, // true ...
0
votes
1answer
40 views

Can't wrap my head around this function - any help would be appreciated

OK so I am working on a theme that utilizes the customizer a lot. When you change a color for example, the necessary css gets added to the header, but when you click default, the css with the default ...
0
votes
2answers
3k 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 ...