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

Improvements on portfolio CPT and Metabox

I've been developing a CPT that is going to be used as a portfolio to display my projects, I wanted to add some extra customisable options to display certain aspects of the CPT such as the caption ...
0
votes
1answer
10 views

Permission functions within wordpress

I'm currently developing a website and am exploring all possible options to restrict file viewing. I'm trying to find a way where I can load php files like my theme-options.php and cpt.php without ...
0
votes
0answers
7 views

Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can ...
-1
votes
0answers
8 views

Woocommerce 2.1.7 related products - tags instead of categories [on hold]

I have the following lines of code in my website that will display the related products at the bottom of my single product pages using the WooCommerce 2.1.7 plugin... functions.php: // display ...
-3
votes
0answers
19 views

Forgive my stupidity [on hold]

There is a custom side bar that lists 3 sections of menu items. I want to have an on click javascript function for each of them that is unique. where is the actual loop/presentation code where i can ...
0
votes
4answers
41 views

Simple Wordpress function / plugin to redirect a site

Is there a way to create a simple function that redirects every page of a site to another site? I've Googled around but all the plugins / functions that I've found are only really meant for ...
0
votes
1answer
19 views

current_page_item is missing inside wp_nav_menu

I'm using the function wp_nav_menu like this: <?php wp_nav_menu( array( 'container' => false, 'echo' => true, ...
0
votes
1answer
16 views

Declare a function before plugin does on the theme functions.php file

I'm working with a plugin that declares a function using this format: if (!function_exists('ABdevDND_get_current_post_type')){ function ABdevDND_get_current_post_type() { ... } } I'm ...
0
votes
0answers
20 views

Widget editor not displaying in Dashboard

I'm not sure if this is because of the new 3.9 update, because I haven't had to mess with any widgets in a while, but my active widgets won't display in the editor anymore. I've uploaded a screen ...
1
vote
0answers
24 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...
-3
votes
0answers
32 views

Best code to add Open Graph tags to Facebook [on hold]

There are tons of snippets to add open graph tags to WordPress, but what's the most-complete way to add open-graph with functions.php. A code which adds code and tags to all posts, pages, archive ...
2
votes
0answers
58 views

Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information ...
0
votes
1answer
35 views

Deactivate a plugin on wp version

I've creating a theme options page at the moment and was playing around with this function deactivate_plugins() I'm running wordpress 3.8.3 so running this code in my plugin should uninstall it. ...
1
vote
1answer
37 views

Wordpress function/template tag to get first n words of the content

OK, this might be a duplicate, I was just unable to put my idea in proper search terms, sorry for that! Is there a built-in function or template tag to get the first n words of the content? I mean ...
0
votes
1answer
29 views

Create Logout Link Wordpress Admin Menu

I'm looking at creating a Logout link in the Wordpress admin menu that when clicked the user is logged out immediately. I don't want the Logout link to be a submenu of an existing menu, I just want ...
0
votes
1answer
32 views

Fatal error: Cannot redeclare when switching themes

I've built a theme from scratch which is named "core". Core has a child theme called "core_child". My child theme works perfectly and only contains the following: /images screenshot.png style.css ...
1
vote
1answer
45 views

Making Quote Plugin more efficient

I've been working on this plugin the past couple of nights and have been jotting down idea's of how to improve it. My knowledge of php isn't the strongest and I'm learning as I go along most of the ...
0
votes
1answer
31 views

Adding body class when post contains a specific shortcode

Simple shortcode function : function my_shortcode_function($atts,$content=null){ // Do something return $content; } add_shortcode('my_shortcode','my_shortcode_function'); I wonder how to add ...
0
votes
1answer
21 views

Gravity Forms After Submission - GFFormsModel::update_lead_field_value?

I am working with Gravity Forms. This code works with a couple issues : add_action('gform_after_submission_14', 'post_contract_update', 10, 2); function post_contract_update($entry, $form) { ...
0
votes
0answers
13 views

function triggered by “manage_users_custom_column” filter not working

I am trying to add a custom column un users.php but it stays empty. I have successfully added a column to the users admin page with this code in my theme's functions.php file: function ...
0
votes
1answer
36 views

Saving an array to get_options

I'm trying to save an array to get_options in wordpress, I'm aware that I don't have to serialize the array due to get_options doing that. At the moment I don't get any success of failed message upon ...
0
votes
1answer
33 views

How to extract the variables out from “add_shortcode” function?

In Wordpress, lets say i have a custom Shortcode function, like: function foobar_func( $atts ){ //whatever required processings here... $foo = "the value is foo!"; $bar = "the value is ...
0
votes
1answer
16 views

Permission error on plugin save

When I pass a quote to the input field and save it I get this error message in wordpress - I'm using the latest installation version. Error "You do not have sufficient permissions to access this ...
0
votes
1answer
34 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
30 views

relation OR instead of AND - Filtered term ID's in loop

Question not related anymore.. First I tought about the relation OR/ AND for results, but I believe I should work with 'operator' => 'NOT IN'. I would like to query the results that meet multiple ...
1
vote
0answers
34 views

Add .htm extention to a custom taxonomy

I need to add '.htm' to all my urls on a new site - client requires that, as I am converting a old static site into WP. (I use Remove Taxonomy Base Slug to hide the slug of my custom taxonomy "topic" ...
0
votes
0answers
42 views

Create thumbnail on PDF upload with Gravity Forms

I'm working with some great code that was provided recently to create an image thumbnail from a PDF upload, and I'm now trying to implement this in the functions file so that it can be applied to any ...
1
vote
1answer
19 views

How to get correct URLs in network wide menu (Multisite)?

I'm using this function to switch to my main website's navigation and display it on all sub sites in my multisite network. Ideally the links should have the following format: ...
1
vote
1answer
43 views

Get current post id in functions.php

I have a wp_localize_script() function in my functions.php where I need to push the current post ID of the current post to a jQuery file. So I was wondering how you can get the current post ID of a ...
0
votes
0answers
15 views

Saving plugin data returns “You do not have sufficient permissions to access this page.”

I'm developing a quote plugin which will save a quote to the WPDB using a form to input the quote. I've created half this code and got the other piece from another programmer on here. I'm looking to ...
0
votes
3answers
28 views

Formatting Multiple add_theme_support Arguments

In my functions.php I have the following: add_theme_support( 'post-thumbnails', 'html5', array( 'comment-list', 'comment-form', 'search-form' ) ); …which in WP 3.8.1 disables e.g. featured image ...
0
votes
2answers
64 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
0
votes
3answers
17 views

Print Post Parent Title

I'm trying to print the posts' parent title on the page as well as the post title for that page. This is how my content-page.php template currently renders the page title. the_title( '<header ...
0
votes
0answers
20 views

Dynamic banner for use on external sites

Pro question: we would like to display our most current wordpress articles on external sites (something like advertisments or banners). I think this could be easily done with iFrames, but I doubt ...
1
vote
1answer
59 views

Saving Plugin settings to the database

I'm not a complete novice with php or wordpress but am wanting to approach this problem the most efficient way so believe asking here will help. I've got a plugin that randomly generates a quote - ...
1
vote
1answer
37 views

How to customly read JWPlayer's “Playlist” items by using its “playlistid”?

In Wordpress (3.8.1) and JW Plugin (v2.1.2) with JW Player (v5), I need to read off the items contained in the Playlists of the JWPlayer Plugin. Normally The JWPlayer Plugin works like this, via ...
0
votes
0answers
31 views

wp_list_bookmarks(); not displaying anything

Bizzarely, I can't get the wp_list_bookmarks(); function (inside a page template) to render anything. Hope somebody can point out something obvious! Cheers. Here's my code: <?php /* Template ...
1
vote
1answer
39 views

Execute a shortcode when clicking on a image

I asked this in stackovorflow under javascript and was informed not possible so I trying here I have a shortcode for a opt-in form and I want it to pop up when a image is clicked I tried the ...
2
votes
1answer
37 views

Custom registration URL lost when user makes signup mistake

I've followed instructions found on this site and elsewhere on the internet intended to let me give certain people a registration link that will let them sign up with a specific user role. The user ...
1
vote
2answers
42 views

When using wp_enqueue_script(); in a theme why don't we use add_action?

When using wp_enqueue_script in a plugin, I have always been told to use an add_action : function add_my_css_and_my_js_files(){ wp_enqueue_script('jquery-validate-min', ...
0
votes
2answers
48 views

how to display a page before the home page

I want to build a wordpress theme in which there is a landing page made by an image and a logo; when the logo is clicked the theme have to go to another page in which there is the navigation bar and ...
-4
votes
1answer
36 views

Echo get_option displays as text

I am trying to use some code that is stored as a settings option in WordPress. When I try to use the following code below however, it show up as plain text instead of executing. The option I have ...
4
votes
3answers
102 views

Plugin update error message

I'm working on a client website where the framework requires a specific plugin version to work properly. With the follow lines of code in my functions.php file, it stops the plugin from updating ...
0
votes
0answers
17 views

action that only applies when certain item is in cart

I am using a function to automatically apply a coupon for certain products.The coupon only applies to a single category and is for a one-time event where those customers are only presented this ...
5
votes
4answers
207 views

Add image size if page template

I'm building a members website with WordPress Multisite. Is it possible to restrict how many images are being generated depending on the selected template? I have tried the following lines of code ...
2
votes
1answer
28 views

Change comment_reply_link URL

I have a reverse proxy pointing my WordPress Blog (CNAMED at blog.example.com) to www.example.com/blog/ Most everything is working well except for comment reply links. Those are skipping the /blog/ ...
0
votes
0answers
28 views

Load wordpress enviroment for external content?

We have a couple of forms and landing pages that cannot be stored in our wordpress installation as posts/pages. For this reason they remain apart from our Wordpress installation in a folder though ...
-1
votes
0answers
24 views

How to make a shortcode for returning HTML Value using condition inside a function.php?

I'm practically new in Wordpress Development and currently trying to make a shortcode for displaying condition user_logged_in by returning HTML format. Its not working very well and deteriorating the ...
0
votes
0answers
35 views

Problem with checkbox using custom field archive

How can i get archive base a custom field. I try this but my hosting say there is a problem with my code, the code make manny select in the database.. I have 1 post type, and 2 custom field ...
0
votes
0answers
35 views

How to: Get the first image from the next and previous post in single.php? (5 posts)

I know I can call a function below but it works in loop at index.php only. function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = ...