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

Setting up the child theme so as to enable right-to-left WordPress?

I want to make a child theme for twentyfifteen theme in WordPress to show in right-to-left direction. I read the documentation on that in Codex. But to be honest, the documentation was good for a ...
0
votes
2answers
79 views

Refresh page after form action

I've a listing post page where all posts are shown. On each post's row I can perform actions like delete, archive etc. So imagine that: I have an "archive" button; I push on it and I get a modal (...
0
votes
0answers
38 views

wp_mail Not Working Correctly

I am trying to use wp_mail to send an email with an attachment, but there are a few issues: 1) The attachment does not appear 2) I have to use the direct URL to send the email (not working on button) ...
0
votes
0answers
26 views

How to get new posts via Ajax when using Waypoint.js

So I have an ajax call in one of my pages when you hit a certain waypoint within the dom. I then call a Wordpress function that I have created. The function is working in that it gets the first posts, ...
-1
votes
1answer
70 views

Make a PHP file with a function

I want to use the breadcrumb function as listed here: https://gist.github.com/melissacabral/4032941 Putting the code in functions.php works for me, but I would rather have it in a separate PHP file. ...
0
votes
1answer
62 views

Wordpress Jquery+scripts enqueue issue

I'm having some issues in loading a custom jquery slider into a wordpress site I'm working on: I'm not super proficient with theme development but I'm studying hard and I spent lots of days trying ...
9
votes
1answer
105 views

When should you, and when should you not, use wp_list_pluck()?

While learning about metadata lazy-loading, I met these lines of code: // Don't use `wp_list_pluck()` to avoid by-reference manipulation. $comment_ids = array(); if ( is_array( $comments ) ) { ...
2
votes
1answer
110 views

Gallery images titles - get from post

Is there any possibility to make a functions hook, which will automatically override titles of added images (or added during gallery creation) with post title? Just like in the example: - im creating ...
0
votes
1answer
67 views

Merging two excerpt functions to work with conditions

I have two functions that affect the_excerpt: // Grab First Paragraph Of Text And Ignore Images For Excerpt function awesome_excerpt($text, $raw_excerpt) { if( ! $raw_excerpt ) { ...
0
votes
1answer
13 views

Newest comments first not working

I'd like to have my newest comments listed first but nothing seems to be working. In the dashboard I set In comments.php I have <?php wp_list_comments(array( 'reverse_top_level' => true, ...
0
votes
1answer
81 views

How do I call wp_mail from HTML?

This is meant to be up in the next week or so, but I am having a lot of trouble getting the site to send emails to an address specified in an input box. I need to use wp_mail as I need to be able to ...
2
votes
1answer
48 views

add_filter priority problem

I'm using basic user avatars for use local avatar in wordpress. And i have a simple function in my functions.php for getting avatar direct link. My problem is if i use get_avatar function in my ...
1
vote
1answer
27 views

Setting youtube size in functions.php

I'm using the code below to set the width and height of youtube embeded links ////////////////////////////////////////////////////////////////// // Youtube shortcode //////////////////////////////////...
1
vote
1answer
34 views

Add tag parameter to category.php

I want to give users the ability to refine their results in the category section. Like if the user is in the "car" category section in there he can then refine the "search" by color, number of wheels, ...
1
vote
0answers
52 views

Wordpress not cropping thumbnails properly

For some reason Wordpress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in my functions.php: add_image_size('main-...
0
votes
0answers
12 views

Gallery Meta box not showing on single post

I want t replicate a Tour module into restaurant, not much gud in development so have created a Custom Post Type "Restaurant". It has same features as "tour" have but i get stuck when a Gallery meta ...
5
votes
1answer
36 views

Customizing subject in comment notification e-mails

How do you customize the following code in functions.php in order to have "New comment" as subject in comment notification e-mails instead of the default WordPress subject? function ...
0
votes
0answers
9 views

Add a “NEW” banner to bottom of every new post [duplicate]

I'm working on http://juniorgoldreport.com The owner wanted a "new" banner tag on new post's, so to make it easy I was going to put it on the images, but because of scaling and different images it's ...
2
votes
1answer
49 views

A snippet after every image

folks. I need to put a piece of code after every post image (post attached image). it's something like this: <img class="alignnone size-full wp-image-3079" src="imgurl.jpg" alt="02" width="2592" ...
1
vote
1answer
56 views

wp_register_script(… $in_footer = true) not working

I'd like to load some javascript files in my footer. I tried to accomplish it in functions.php like so: function my_init() { // LOAD JQUERY wp_deregister_script('jquery'); ...
3
votes
1answer
31 views

Including a function into a theme

I have a small function, that I have been using for many years, to clean up user entered text on website forms that prepares the input for use in MySQL queries and also removes all the input from ...
3
votes
1answer
23 views

What function to hook for changes made in status and visibility of a post

I have a function to run every time a post is published or updated in anyway. Right now I am doing function myFunction(){ //Do Something } add_filter('publish_post','myFunction'); add_filter('...
1
vote
1answer
42 views

Trying to establish connection to External Database

I'm trying to get a connection to a separate external database from the database the wordpress site depends on. I have a PHP file inside the same location of my theme, it is basically a blank PHP it ...
0
votes
1answer
39 views

Add custom field to attachments in a specific category

I have a working function that adds a meta field to all attachments (so I can enter the url of a video). I would like this field to populate only on attachments in the "video" category. I've tried ...
1
vote
1answer
43 views

Automatically include all php files in a child theme directory

I'm currently using a custom child theme across multiple sites, and would like to modularise particular custom features (e.g. ecommerce) by separating them into individual php files, and including the ...
3
votes
1answer
27 views

I changed “Howdy” in the admin bar in the dashboard, but when I'm viewing the site it still says Howdy!

I used the following code to replace "Howdy" in the admin bar. This is lovely. However, when I view the site while logged in, the word Howdy reappears. As long as I'm viewing the dashboard, no howdy. ...
0
votes
0answers
46 views

Block user redirection to wp-login.php on leaving password blank in frontend login

When a user leaves the Username / Password / Both Blank and clicks login in frontend buddypress login, he is being redirected to wordpress admin login url stating wrong username/password/empty ...
0
votes
1answer
28 views

Pass arguments to function class with do_action()

I'm trying to develop a "simple" script where i can create a filename with a timestamp of the last edit. For this I'm trying to code a class – but I'm having problems to pass an argument to add_action....
1
vote
1answer
27 views

Echo tags used to describe the theme

I've got a plugin I am working on to return an instance of the WP_Theme object properties. The plugin essentially allows for a simple child-theme creation. /* Theme Name: <?php echo $...
0
votes
3answers
98 views

Add URL parameter to all internal links using a specific theme

I got stuck with some modifications and maybe someone could give me some help. What am I doing I use the multiple theme plugin to switch themes for my WordPress project. To switch between the ...
-2
votes
1answer
29 views

Trying to Add a LEFT Sidebar?

I'm running the base 2016 wordpress theme. I have modified it to allow for a left side sidebar. I am able to see the admin side of the sidebar like so: I have registered the call in the functions....
0
votes
1answer
24 views

How to store a number (coming from cookie) into query vars for later usage in other filters?

I have a small HTML5 game playable (as "canvas") at different social networks, which sets an HTTP cookie. When a player comes to my Wordpress site (acting as help and support website for the game), I ...
0
votes
0answers
23 views

Auto expire page that contains specific text

Sorry, I'm relatively new to Wordpress. Is there a function or script that can automatically expire a page that contains specific text? I am using an RSS feed to display some content on a page (not ...
0
votes
0answers
18 views

How to a override parent theme page that has been included with require_once?

I need to override a parent theme file which is added in function.php like this: if (class_exists('Woocommerce')) { require_once( get_template_directory() . '/woocommerce/config.php'); } A template ...
0
votes
0answers
16 views

auto metakey value on post tile

I have this metakey "word_srch" the metakey has no value, i have to input the value in the custom field in the backed, instead, how can i create a function code that will automatically input the value ...
0
votes
1answer
35 views

wp_redirect only works on main site and not on other sites

My main site is https://www.domain.com/, all my multisites will have https://www.domein.com/multisite1/ link. I made a function in functions.php which will check if the option (in the admin panel) is ...
0
votes
0answers
16 views

Transfer custom post nav (prev/next) from one to another theme

I bought two themes and just want to assume a special next/prev post navigation from the first theme in the second theme. I've searched the theme files and found the function, which declares this ...
1
vote
1answer
28 views

Set spesific size of featured images

I am trying to reduce the loading speed of my webpage. Google PageSpeed Insights tells me to optimize my images. In the following code, how can I set an image size so that if the uploaded image is ...
3
votes
3answers
57 views

Is the Wordpress HTTPS Plugin Still Safe To Use? [closed]

I have a client who wants to accept Authorize.net donations on their website. We only have a need for one page to be secured for our purposes. I've put a lot of research into this and it seems that ...
2
votes
0answers
23 views

Date/time limitation of posts where function must be executed

I have this piece of function in my functions.php file: function user_content_replace($content) { $sentences_per_paragraph = 3; // settings $pattern = '~(?<=[.?!…])\s+~'; // some punctuation and ...
-2
votes
1answer
26 views

Getting error on function.php

<?php define('TEMPPATH',get_bloginfo('stylesheet_directory')); define('IMAGES',TEMPPATH."/images"); add_theme_support('nav_menus'); if(function_exists('register_nav_menus')) { ...
2
votes
1answer
39 views

Theme-Config tab in admin Pannel?

Sorry, for my broke english. There are few questions that I'd want to ask that got me quite confuse. I will try to phrase and describe my question the best way I could. Starting with a bit of ...
0
votes
0answers
19 views

Plugin - overwritting entire non-pluggable function

In order to achieve what I want to do with my plugin I need to modify several functions inside comment.php and comment-template.php ( for instance some code lines like if ( is_user_logged_in() ) : ) ...
2
votes
0answers
50 views

Download external images with function

Actually, i display images on my site from other sites. Url is on a custom field name "couv" I'd like to download theses pictures on my site and create a new custom field with the new value "couv2" I ...
0
votes
2answers
30 views

Email Exists ERROR into Ajax registration form

My problem is that I can't verify if some user insert an existing email into AJAX registration form. However my form is working fine, it's registering users and it's giving all other errors, like "...
0
votes
1answer
66 views

Get Attachment Category Name

How can I call the name of an attachment category? Something that would look like <?php get_attachment_category_name ?> or $attachment->category_name This would simply output the name of ...
6
votes
4answers
291 views

Issues with title-tag and document_title_parts

Wordpress version 4.5.1 I'm trying to dynamically update page titles on a particular template. After lots of digging and learning about the wp_title() changes, I'm attempting to use ...
0
votes
0answers
20 views

get_pages() shows either ALL pages or just main-menu

I'm losing the battle with get_pages(). What I'd like is a list of child pages to display on each main-menu parent page. I'm trying get_pages() rather than wp_list_pages() as I'd like to be able to ...
0
votes
0answers
20 views

Echo multiple tasks if a common function exists

How can I echo multiple tasks if a common WordPress function exists. For example, I want to reduce the following: <?php if (function_exists ('pluginName')) echo someName (1); ?> <?php if (...
0
votes
1answer
38 views

Show modified time if post is actually modified

I want to display post updated time only if post is modified, I am using function the_modified_time() . So I just read about that there is if statement that can be used to check if post is even ...