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

I would like to write the output of a function in normal post.php fields

I have this function, and it prints, displays these values ​​directly in the published posts: function gen_num() { global $post; $mixnames = get_post_meta( $post->ID, 'fieldnames', true ); ...
0
votes
1answer
18 views

To make some div display for a longer time

I have this code to display some of my div for 1 day then disappear. This code to be placed in functions.php function post_from_today_class($class) { //add .new-post-today to post_class() if newer ...
0
votes
2answers
29 views

How can I use custom menus with a Bootstrap WordPress theme?

I have this 'primary' menu with a few items in the CMS, which I can list nicely with this PHP code: $args = array( 'theme_location' => 'primary' ); wp_nav_menu( $args ); The PHP outputs ...
0
votes
1answer
31 views

Getting a 404 on single custom post type page when using rewrite on a custom taxonomy

I am getting a 404 on my single custom post types whilst using the 'rewrite' option in the custom taxonomy. If I take the rewrite out the single page works but the custom taxonomy archive then 404's ...
0
votes
1answer
99 views

How to get subscription key or id using Woocommerce Subscriptions

I need to get the subscription key of a particular subscription to pass into a custom function. I have referenced the documentation where it shows how to get the key, but I have failed to integrate ...
-1
votes
1answer
18 views

Custom posts password protect

my site is highly based on clients and we want to have very strong password protection for a certain custom type post. We have a custom type post named "something" and here is it's declaration: $...
0
votes
1answer
29 views

Allow BBPress participant role to trash topics

I have a small project with BBPress roles, here is what needs to happen if at all possible. Participant Role Participants should be able to trash posts. Participants should be able to restore ...
0
votes
1answer
33 views

Search and Replace Script Loader in Head Only Works in Footer

I've got a function that uses script_loader_tag filter to search and replace adding asynch="asynch" attribute. It works. I don't want this doing anything in the footer, but rather the header alone. ...
0
votes
0answers
42 views

Benefits of Using Wordpress Methods over Straight SQL Queries

I am building a "wrapper" front-end for Wordpress. My thoughts were that simply using PDO to run all queries would make the processing much much faster. Of course what this means is that I miss out ...
0
votes
0answers
50 views

Woocommerce subscription hook after renewal

I have a web store where users can purchase subscriptions (1 month, 6 months, 1 year). My store uses Woocommerce Subscriptions v2.0.8. What I want to achieve is when a subscription is renewed, I want ...
0
votes
0answers
59 views

How to add a description of the shipping method, woocommerce?

How to add a description of the method of delivery. Like payment methods Is it possible to add textarea in the admin panel for editing shipping method? Thank you
0
votes
0answers
78 views

Force update all posts in custom post type, no content changes

I have imported data from a custom post type that has location data for a map plugin (Progress Map). I have about 500+ posts each with different location data. For some reason the location data isn't ...
0
votes
1answer
42 views

How to overwrite template.php file

I'm using a child theme for my website. I tried to enqueue template.php file wich exists in includes folder but making any change in the template.php file of the child folder didn't affect pages. ...
0
votes
1answer
44 views

How To Display Category list from Portfolio post type plugin?

I'm new from WordPress development. I want to display portfolio category list in my theme, I'm useing portfolio post type plugin what must I do ? what code or WordPress function must implement in ...
0
votes
0answers
51 views

Remove html content from Auto-Generated Excerpt

I've a website that syndicates content, and each article gets prepended with html content similar to "From Source A:" Wordpress obviously strips the html from that content when auto generating the ...
-1
votes
1answer
20 views

Custom shortcode not being included in content paragraph [duplicate]

Ive created a custom shortcode via functions.php to display a phone number in the content when the shortcode is used in the WYSIWYG field. function contact() { $contact = get_field('contact',...
0
votes
0answers
43 views

Help needed with Wordpress Function/Loop please

I mostly come from a Front End/Design background and have built a few sites in Genesis/Wordpress but I am now delving into the world of making Custom Posts and pages through using a variety of ...
0
votes
1answer
91 views

How to get the original price of the product in woocommerce?

I have created the code to loop through the product list and display the price $args = array( 'post_type' => 'product', 'posts_per_page' => 100, 'product_cat' => 'hot-deals'); $...
0
votes
0answers
34 views

Featured image in custom post is being disabled

I'm trying to create a custom post as a plugin and so far I'm having some trouble trying to enable featured image on my custom post type. Right now I have created two custom post types but the problem ...
-1
votes
1answer
30 views

Rename file after title , one small problem

I'm using this question: Change Attachment Filename which works but it has a problem. He renames every file with FileNameToRename and it's same image. What I want to do is instead of FileNameToRename ...
0
votes
0answers
33 views

Override Class in Child Theme

I'm trying to customize a theme using Child Theme but I can't find a way to override this class, anyone can help me ? I've tried if ( ! class_exists('Extra_Page_Post_Settings_Meta_Box extends') { // ...
0
votes
1answer
39 views

Code to insert code into single php

I'm using a plugin that puts stuff on my single.php page. I can turn off this stuff by inserting <!--code--> in the text side of the editor for any single post. I want to do <!--code--> ...
0
votes
1answer
71 views

linking stylesheets and scripts with functions.php

I am following along with this tutorial. I am trying to link the javascript and css files that are usually linked in the header using wp_enqueue_scripts in functions.php. With what I have now, only a ...
1
vote
1answer
87 views

Enabling post thumbnails for custom post type

I'm writing a custom post type as a plugin and trying to figure out how I can enable post thumbnails within plugin documentation/template instead of enabling it in the functions.php. I tried adding ...
0
votes
0answers
18 views

Wordpress Costums Field Comment Box on Admin Page (Post Editing)

can help me about wordpress comment field on post editing in admin page? i want to change the default form like picture above : to like this...
0
votes
3answers
216 views

Check if Page Slug Exists, then display that Page's Title

Came across this function to check if a page exists by its slug and it works great function the_slug_exists($post_name) { global $wpdb; if($wpdb->get_row("SELECT post_name FROM wp_posts WHERE ...
0
votes
1answer
48 views

add_rewrite_rule with bottom priority doesn't handle the Wordpress pages

I have a php file named test.php that outputs the page querystring parameter. I want to use add_rewrite_rule to serve my php file, while the WordPress pages which exist already or will be created ...
0
votes
1answer
30 views

Image Crop Not Working

I am building a custom WordPress theme. I am using Advanced Custom Fields to have an area for the user to upload custom images. This is what I have in my functions.php file. My images aren't taking ...
0
votes
1answer
57 views

How add body_class from wp_termmeta

I need to assign a class to the body for woocommerce categories. What I've done: // add the fields when the term is created add_action( 'product_cat_add_form_fields', 'add_product_cat_class_field', ...
0
votes
0answers
44 views

How do I output the returned value of a function that uses an earlier hook?

If I define a function that retrieves a value within an action hook and returns it, what is the best way to call the function in a later hook? My general aim is to write reusable functions with ...
1
vote
1answer
34 views

Pages should have priority when using add_rewrite_rule

I'm using the following code to have dynamic pages function custom_rewrite_basic() { add_rewrite_rule('^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top'); } add_action('init', '...
0
votes
0answers
45 views

Woocomerce update variation sale price in functions

i need to write simple code that changes sale prices automatically. Got a lot of products, and sometimes we got promo for one variation of the specific product. Basically, what my codes does its ...
0
votes
1answer
29 views

Using two loops in one Wordpress template

Hi I am attempting to use two loops in my WP template as I am using advanced custom fields to display info from a custom post type (college) I have tested my code (label 'loop which doesn't work' ...
0
votes
1answer
83 views

How to display content If function exist/condition true?

I've created my custom posts. Data from the same is displayed in let's say single-custom-post.php. Now to clean that file and to remove 100 lines of code, I want to make a new file (let's call it ...
0
votes
0answers
16 views

Getting autoset_featured image to jive with Facebook SDK

I'm trying to set up the Facebook SDK on a site where I'm auto-fetching the first image in the article to become the "featured-image". I would like that auto-fetched image to also be the og:image, but ...
0
votes
1answer
39 views

Multiple navigation menu in same location

Is it possible to have multiple menus in same location but on different pages. My pages are now: cars --car details --car specs motorbikes --motorbike dealers --map --contact Plus about 20 other ...
1
vote
1answer
41 views

WooCommerce add_action hook results in 500 error

I am trying to add a line of text on the checkout page of the store that will go immediately after shipping row. I added the following to my child theme functions.php file: add_action( '...
0
votes
0answers
22 views

MPT Usage with NewsPaper WordPress Theme

I am using Multiple Post Thumbnail Plugin with NewsPaper WordPress theme Plugin Documentation: https://github.com/voceconnect/multi-post-thumbnails/wiki/Frequently-Asked-Questions Hello, I used ...
0
votes
1answer
32 views

wordpress ajax return 0

I'm tryng to set up a panel, this one The menu on the top calls different ajax functions in order to display a thumb. Clicking on the thumb you can see the details in the last box of the panel. I ...
0
votes
0answers
49 views

Call to undefined function language_attributes(), add_action(), wp_header() and wp_footer()

Using a new theme for a Wordpress website I found yesterday in my error report that: Call to undefined function language_attributes() in header.php Call to undefined function add_action() in ...
0
votes
1answer
37 views

Regex works in regexr, but not if I filter content [closed]

I want to filter the content of everypost and add classes to my links depending on certain conditions. At the moment I just want to filter all href attributes from the content and change them. ...
0
votes
1answer
312 views

How to show product SKU on product page

I'm making a website and it seems that product sku is hidden from product page. I have found how to add it to the catalog (shop) page but I need it to show inside the product page. So far, by ...
0
votes
1answer
36 views

How to echo a plugin's function into a template?

I've tried checking for a similar question but couldn't find one. If possible please link me to this as I might be creating a duplicate. Anyways.. I am using a basic testimonial plugin (Clean ...
0
votes
2answers
349 views

Always the Latest google jQuery instead of default Wordpress jQuery

Im using successfully the google CDN jQuery files instead of the built in files from Wordpress with the following code in my functions.php: function register_jquery() { if (!is_admin()) { ...
0
votes
1answer
36 views

How can I add an extra WooCommerce hook

In the standard WooCommerce template file content-single-product.php there is a set of hooks that control the way the page lays out in a series of blocks which are called by a series of hooks eg '...
-1
votes
1answer
73 views

Help finishing script to export WP user data when form submitted

I have been searching for a solution to export WP user data to another application once a form is submitted. There is an article on how to do this but I am too noob to to get it to work and am asking ...
0
votes
2answers
50 views

is_preview() always return false

I'm just starting out on a new Wordpress project and for some reason I can't get the previews working. I have disabled all of my plugins and still i always get false when using is_preview(). ...
0
votes
0answers
42 views

List authors by first letter with letter per page

Currently I have this working with first letter of post title with letter per page. <div class="alpha_navigation"> <div class="inner_alpha_navigation"> <?php foreach ($letters as $...
0
votes
1answer
73 views

remove_action not working, even after changing priority [duplicate]

So one of the functions in my theme is: public function job_manager_job_filters_distance() { //Show some HTML } And somewhere else in the document lies: add_action( '...
0
votes
0answers
45 views

Fatal error: Call to undefined function wc_format_decimal() in class-wc-meta-box-product-data.php on line 996

I Get this error when trying to add a new product. If I refresh the products page, the new product will show up. I can make changes to the product information but the price never updates. It just ...