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
1answer
832 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 ...
0
votes
1answer
975 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only style....
-1
votes
1answer
32 views

Remove Disqus JavaScript from homepage

Hey WordPress friends, I’m using the Disqus comment system plugin, which is working fine. My homepage is just a collection if recent posts and therefore not having the option to leave a comment (as ...
0
votes
1answer
866 views

How to add nav menu items to a specific position within a menu

I'm adding login/logout links to a nav menu using the following code: function rp_add_login_logout_links( $items, $args ) { $link = wp_loginout( get_permalink( get_option( '...
0
votes
1answer
12 views

Both the require and add_template_part function are not including the file

I'm trying to add a require function in my functions.php, to include a file that is in the wp-content folder. I first tried this with the function content_url . 'filename.php'So the line of code ...
0
votes
1answer
27 views

Autogenerate a Table of Contents

I am trying to generate a Table of Contents at the top of each of my posts and would like to minimize the requirements on the author. Ideally, the author would enter only various levels of the header ...
0
votes
0answers
24 views

I have problem when use antispambot for other languages

I have Issue about " antispambot() " when I enter German language like "höhen@yahoo.com" , it's return incorect characters . I know this function encode email address but It's work fine just for ...
-1
votes
0answers
16 views

Change category link. Lead it to a specific page

How can I change a link of any shop category in functions.php? I have 4 shop categories. To one of them I need change its href-link, it should go to specific shop page. How can I approach this?
0
votes
1answer
22 views

How do I integrate my Child Theme into a Custom Template?

I started working on this yesterday, and while I was able to successfully load my child theme, some of the site functionality went haywire. I suspect that I may need to add some code to my functions....
10
votes
2answers
13k 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: America",...
2
votes
4answers
604 views

Get only <ul> or <li> from the wp_nav_menu

I have tried several options like setting 'container' => false and registering the theme_location and searching on forums but I am unable to get rid of the "div" coming with the wp_nav_menu in my ...
1
vote
1answer
993 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
-1
votes
1answer
41 views

Display post_meta-by_key on product catalogue

I'm trying to display a custom field in my woocommerce bookshop catalogue. I have added the field "author" and I want to display it after the product title, and before the price. http://www....
-2
votes
0answers
24 views

How much PHP one Needs to Build a Professional WP Plugin - Basis WP Knowledge and a PHP assistant will help me to Build One Such Professional Plugin? [closed]

I started only sometimes back to learn wordpress. Sometimes I feel that WordPress is too vast, but sometimes I feel that its coding practice can be mastered within 2-4 months. When I say that its ...
0
votes
1answer
19 views

Using wp_localize_script in template file - is it secure?

I have the following code inside one of my template files (NOT functions.php) $datatoBePassed = array( 'pageTitle' => get_the_title() ); wp_localize_script( 'main-js', '...
0
votes
0answers
9 views

Class For Dependent Child Post Data using get_posts()

I want to use a class to display various parts of a dependent post via a class. This is my first stab into OOP, so please be try to be somewhat gentle, if possible. :) At a high-level I have a two ...
0
votes
2answers
36 views

How to know if user logged in

I have PHP code <?php if ($_SESSION['logged_in'] == 1) { echo '<script type="text/javascript">var logged_in=true;</script>'; } else { echo '<script type="text/javascript">...
-2
votes
0answers
21 views

How can I disable author and hide their posts?

I want to disbale authors and after that they gonna be hide such as their posts, media and etc. also on the contrary of above , when i active authors their posts display to every one Any idea?
-3
votes
0answers
16 views

how to use download links with CONTACT FORM 7?

I want to allow user to download my PDF only after they filed their email id. On every post there is a different PDF to download. I am saving these download links in custom fields of WordPress ...
-3
votes
0answers
17 views

OOP help, how to implement custom lookup in my associative array within functions.php

I'm writing a function to execute on a custom action: //############## START OF NON WORKING CODE add_action( 'gform_pre_submission_1', 'myCustomFunction' ); function myCustomFunction( $form ...
1
vote
1answer
1k views

Remove Header and Footer in iframe

Many people embed my website's pages in their websites as iframes. I want them to not take my footer, header and a specific division in those iframes. Since, footer, header and mentioned specific ...
-1
votes
2answers
1k 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 ...
2
votes
4answers
2k views

How to display post tags

I'm converting an HTML template into a wordpress theme and I'm having some trouble displaying the post tags within the functions.php file. What I would like to do is add the following code into the ...
0
votes
1answer
535 views

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more ...
0
votes
0answers
19 views

Hide Archives From Past Year in Sidebar (Twentysixteen)

Following the instructions on this page I was able to limit the archive list on the front page of my WordPress site to the last 3 years. However, when I go to individual post pages, the full archive ...
0
votes
1answer
4k views

How to integrate owl carousel into theme without using a plugin?

I've been trying to integrate the owl.carousel into my theme but can't get it to work. The instructions on the page are not for WordPress so I need help with how to properly enqueue the required files ...
0
votes
3answers
431 views

Custom meta box in custom post type not working

As a wordpress newbie I am having problems in adding custom meta box in my "slider" custom post type which I used in some old wp theme. I'm getting a warning: Warning: call_user_func() expects ...
0
votes
1answer
45 views

How to add attributes to a shortcode

Reading the codex, I have: function btn_shortcode( $atts, $content = null ) { $a = shortcode_atts( array( 'class' => 'button', ), $atts ); return '<a class="' . esc_attr($a[...
0
votes
0answers
19 views

Generate and return a PDF file in functions.php

We have the following process flow: 1.) Users fills in a form (name and surname) 2.) Backend php scripts look for the record in local CSV files 3.) If record exists we would like to return the data ...
-1
votes
1answer
36 views

How do grab the main loop, with conditions, and output via shortcodes

I don't have any code for this because I'm not sure how to begin. I created a category called "News". On my homepage I want to show the 3 most recent articles, but I need to output them using a ...
0
votes
1answer
37 views

Redirects based on a JSON file

Having a JSON file, how can we set up WordPress to redirect the urls (if it's found in the JSON file)? For example: { "foo": "bar", "foo-1": "baz" } Then /foo will redirect to /bar and /foo-1 ...
0
votes
1answer
1k views

How to echo Widget Title in Custom Frontend-Template Box

I've created a custom Widget with the help of following code: // Creating the widget class wpb_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of ...
5
votes
1answer
174 views

How to override a function when isn't at functions.php

I am trying to override a function for a theme in the child-theme but I can't get it to work. At functions.php on the theme I can see this require_once line: require_once("inc/alterna-functions.php");...
0
votes
1answer
29 views

Every time I use wp_get_current_user() my plugin breaks

I have been trying to make a sign-out plugin that allows users to sign out from military training activities that they should be at. After they fill out a form explaining why they are not going to be ...
-3
votes
0answers
32 views

Create like button from scratch

Would someone kindly give me a pointer on direction to take to create a simple test data unique to each user that can be updated by other user from front end and saved in database. I know it sounds ...
0
votes
0answers
15 views

How to use $prev_url and $next_url to display posts only out of a specific category

Struggling with a function used to display a previous and next button on a single portfolio page. I have set two pages up with display of a portfolio. Each page displays a portfolio with a unique ...
3
votes
2answers
420 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 ...
0
votes
1answer
432 views

display custom portfolio tags

This is a part from the code that is used to display portfolio categories: $post_cat = array(); $post_cat = wp_get_object_terms($post->ID, "portfolio_category"); ...
3
votes
1answer
3k views

Edit tag cloud widget number

By default, the WordPress tag cloud widget has a set amount of 45 tags to display. This can be seen in the wp-includes/category-template.php file. By default, the WooCommerce plugin which I have ...
0
votes
0answers
29 views

How to create a global variable in a plugin to use in another plugin

I have a variable in a plugin that stores values ​​to her being fired, these values ​​are entered in the [post_title] but before that he a variable of $post_title_template name plugin and would like ...
0
votes
0answers
25 views

Passing dynamic local variables without using class

I creating functions in my function.php and I have a question regarding passing local variables between functions if the variable is a dynamic one that changes according to certain conditions. Let ...
1
vote
0answers
18 views

Pass updated local variable between functions? [duplicate]

I creating functions in my function.php and I have a question regarding passing local variables between functions. Let say I have the functions below, A and B, and I have the variable $amount. Now ...
1
vote
1answer
43 views

Reuse variable in hook callback

I'm setting up a child theme in WordPress and I can't make add_action to be fired within functions.php. Functions.php is called and I can run code from within. Any idea on what I'm doing wrong? $...
0
votes
1answer
457 views

How to display 2 function calls in same line?

<?php the_author_posts_link(); ?> <?php the_time('g:i a'); ?> When I call above 2 functions you will see the output in two lines. But what Need is "Andrew 2.10" I need both output in ...
0
votes
1answer
432 views

Change meta tags programatically

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...
-3
votes
0answers
15 views

Auto refresh the page when time expires [Plugin: Launcher: Coming Soon & Maintenance Mode] [on hold]

I am currently using Launcher: Coming Soon & Maintenance Mode plugin to display a coming soon message with countdown timer to specific date and time when the site gets launched in-front of all the ...
0
votes
2answers
439 views

Shortcode to find and replace URL

I'm trying to create a shortcode that will search within some specified text for a link and replace it with one that I specify. For example: [scode]Click on <a href="www.X.com">this link</a&...
0
votes
3answers
636 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
3k views

How to access global variable $menu inside a class function

am puzzling why can't i access the global variable $menu inside a php class function class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } } using ...
0
votes
1answer
23 views

Help With Creating Shortcode

I'm looking for a way to check just check for an option existing when executing a shortcode, but that option doesnt need a value. How do I just check for JUST an option? For example I tried this out, ...