Tagged Questions

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

Force changing the Site Title and add link

I have the function below, but it's not actually changing the site title where it is called in my theme. function blog_filter($string, $show) { if ( $show == "name" ) { $string = ...
0
votes
1answer
49 views

Allow the access over wp-login.php

I created a maintenace template, and redirected to the folder where it is located via the functions.php file inside the theme folder; this is the code: function maintenance_redirect(){ if( ...
0
votes
1answer
34 views

Simple/basic use of get_current_screen

I would like to load a stylesheet on only 3 admin pages: post.php?post=7&action=edit post.php?post=10&action=edit post.php?post=18&action=edit I was trying with admin_enqueue_script ...
0
votes
1answer
25 views

Is it possible to be more page/post specific with admin_enqueue_script?

I am using this code to load a stylesheet in the admin, but only on post.php related pages: function my_enqueue_for_post_pages_only($hook) { if( 'post.php' != $hook ) return; ...
0
votes
1answer
33 views

Meta Box value not been pulled in

Here is the code that creates my metabox on my CPT named clients it displays fine and seems to keep the value input upon clicking update. The problem is with displaying the value saved within the ...
0
votes
3answers
84 views

Include files in child themes, declare in functions.php

I'm using a child theme. I want to make a change to a file which currently resides in: mybasetheme>includes>sf-content-display>sf-post-layouts.php So I copied the exact same file structure into ...
0
votes
1answer
46 views

How to Add Image to Wordpress RSS-Feed with no Plug-in?

I have searched for adding featuring image to rss feed with no plug-in for WordPress. I have found some examples and applied how it was instructed. But All I have got now is nothing. Still can't ...
0
votes
0answers
29 views

How to add submenu to Wordpress plugin in the same Directory of main Plugin?

I have created a plugin and now i want to add a third party plugin inside of the Main Plugin menu, so it can be submenu. How do you make the second plugin appear? Directory Setup: ...
0
votes
0answers
7 views

How to call a FB function from an admin bar action?

I am using FaceBook's SDK inside of my wordpress application. I need to set up the application so when a user clicks log-out on the admin bar, it will fire facebook's log-out function. in order to ...
3
votes
1answer
49 views

Autogenerate wordpress shortcodes using array?

I was create a shortcode which automatically generate shortcodes with given array key and value. Function names does not generate dynamically. Note: Array KEY = ShortcodeName and Value = Wordpress ...
0
votes
1answer
28 views

Redefine function arguments before rendering

How to change args values before function output (filter default values before call) wp_function($arg1,$arg2 = false){code} change to wp_function($arg1,$arg2 = true){code} without php runkit!
0
votes
1answer
30 views

Add a class to post if it has been recently updated

I'm trying to add 'updated recently' after the post title. I've discovered some code which works but because of plugins and some theme coding it affects numerous instances of the_title that it ...
0
votes
1answer
80 views

Redirect to post after publish or update a published post

How can I get the permalink of a post from functions.php in my theme? I know this code: get_permalink($post->ID); but this produces something like this: mydomain.com/index.php?p=123 and I ...
0
votes
1answer
15 views

Return link pages instead of displaying them

Is there any WP function to return the pages links instead of displaying them with wp_link_pages()?
0
votes
0answers
43 views

Working widget does not show up in appearance->widgets

I try to add a custom widget for use outside of a normal sidebar. For that I have created class myfirst which extends WP_Widget and with appropriate function overrides. namespace widget; class ...
1
vote
0answers
42 views

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
0
votes
0answers
19 views

Automatically create featured image on post publish

I know how to make an image display IN PLACE OF a featured image if the post has no featured image, however, as far as the database is concerned, the post still has no featured image. In my theme, ...
1
vote
0answers
44 views

How to remove custom post type and add category and post name

I have a custom post type called listing and taxonomy for this listing is called listing_cat. At the moment my wordpress permalinks appear in this format ...
0
votes
2answers
73 views

deregister scripts on certain page

i need to exclude certain scripts from running on a certain page. i have tried this code but it's not working - when i inspect the page the scripts are still being loaded into the footer of my page. ...
1
vote
4answers
105 views

jquery won't load in footer

I wanted to move jquery to the site's footer, but that doesn't work. I've tried it with the following code. As you can see, I have a couple of another scripts and they load correctly on the footer. ...
0
votes
0answers
68 views

Problem loading wordpress functions outside of wordpress

I´ve just finished setting up my first ever website and blog, so please be gentle ;) . I am having a problem using some functions outside my wordpress installation (blog.example.com). To be ...
8
votes
2answers
195 views

Displaying the number of updates available in the Admin area

I am having an issue finding out how to display the number of plugins/updates available to call somewhere else other than the admin header. I found the function wp_get_update_data should be what I ...
0
votes
0answers
45 views

Custom frontend post not working?

Hi I am creating a custom post front end submission. This is my code to submit the custom post details. Here the validation is not working as well as it will not submit the post. When i submit the ...
0
votes
0answers
101 views

Wordpress Wp_nav_menu How to create Columns in submenu

i have been trying to develop custom navigation in wordpress. i want to add columns in sub menu item. i want to add images in navigation as well as create Multi column Navigation. Please check this ...
0
votes
1answer
61 views

My post views doesn't seem to be counted correctly

I'm using the following codes to count my posts views, so that I can use it in a widget, but it doesn't seem to be updating correctly. I know some posts have more views than the ones showed on the ...
0
votes
1answer
23 views

Difference between get_userdata() and get_currentuserinfo()

I've already read the WordPress documentation for those functions, but is still unclear for me where is the difference between: get_userdata() vs get_currentuserinfo() As far as I know the ...
1
vote
0answers
48 views

Wordpress PHP Conflicting User Sessions

I'm using the following function to programmatically login users via the frontend: function auto_login() { $username = $_POST['user']; if ( !is_user_logged_in() ) { $user = ...
0
votes
1answer
26 views

Dumping variable in custom pre_gets_post function in functions.php, returns NULL

Problem Summary: I am using firePHP to analyze my variables in a custom function, but it does not display their contents into the console as I would expect. I also used var_dump(), it returns NULL. ...
1
vote
1answer
196 views

Redirect if not logged in?

I've tried this to redirect people who aren't logged in to certain page. It ultimately shouldn't matter what front end page they visit, but should redirect to whatever page is chosen as the landing ...
1
vote
2answers
47 views

How to add a rel attribute to images that contains their categories?

I've added categories to images, so that I can use them to filter images within a portfolio page. Now I'm thinking I need to add the rel attribute to each image that contains its assigned categories. ...
0
votes
1answer
62 views

Create special button on WP Tiny MCE Posts Editor for Shortcodes

I am trying to create a special button on the Tiny MCE editor on the Post Editor of Wordpress. I want to create a button for my created shortcode tooltips. Check out my desired output: ...
1
vote
3answers
55 views

Best practices for multiple Custom Feeds functions

I created two new WordPress RSS feeds in my theme functions: // Custom Feed 1 add_action('init', 'customRSS'); function customRSS(){ add_feed('feedname', 'customRSSFunc'); } function ...
0
votes
2answers
67 views

How to add iOS & fav icons to the theme?

I want to add iOs, Android and favourite icons to the website. Generally I udnerstand how they shold be implomented: link files in the head section and you good to go, however there are many lines ...
0
votes
1answer
43 views

Function in Child Theme not overriding Parent Theme function [duplicate]

I have read up on this and tried it myself, but I cannot seem to figure out how to override a parent theme function using my child theme. I need to know what I am doing wrong (and I am sure there are ...
0
votes
4answers
39 views

How to obtain the current website URL in my theme?

I am working on a custom theme and I have the following doubt about how to correctly insert the link to some section of my website into the theme. If you open this link you can understand what I need ...
0
votes
1answer
31 views

Adding Read More to Custom excerpts

I've added the following code to my functions.php: function new_excerpt_more($more) { global $post; return '<strong><a class="moretag" href="'. get_permalink($post->ID) . ...
0
votes
1answer
49 views

Create input select image URL?

My code in functions is: <input type="text" name="Cat_meta[img]" id="Cat_meta[img]" size="3" style="width:60%;" value=" <?php echo $cat_meta['img'] ? $cat_meta['img'] : ''; ?>"> How to ...
1
vote
1answer
37 views

How to Reference/Echo Variable from Another PHP Function

I have successfully set up a PHP function for my blog posts to create a shortcode to automatically display/style an iFrame tag for a YouTube video, as well as pull in the duration and view count ...
1
vote
1answer
46 views

How do I add Bootstrap and LESS to my migrated WordPress site?

I'm migrating a website to WordPress - it uses both Bootstrap and LESS. I found a snippet online for enabling Bootstrap and the outputted CSS via functions.php: function theme_add_bootstrap() { ...
0
votes
2answers
49 views

Differences when using the the_time and the_date functions

I have some doubts about how work the WordPress the_date() functions definied into general-template.php In a page I show the posts archive using this code snippet into a loop: <article ...
0
votes
1answer
60 views

Can I show also the post date using the wp_get_archives() function?

I am pretty new in WordPress theme development and I have some doubt about the wp_get_archives() function: http://codex.wordpress.org/Function_Reference/wp_get_archives In my website I have create ...
0
votes
0answers
23 views

Creating a filter to modify links ending in .pdf

I'm trying to create a filter that checks for links that are to PDFs, and append the href attribute with something like /form?file=[path to pdf]. For example, starting with: <a ...
0
votes
0answers
16 views

Run function after post is updated

I would like to run a function after a post is saved. That function takes a .txt file thats uploaded with Advanced Custom Field file field, makes it into an array to then a json data. I want the json ...
0
votes
0answers
31 views

Iris color picker

i try to implement Iris color picker in my wordpress theme and it works fine, but when i include the Iris color picker's files i can't call a custom function via a tag. this is the Iris color picker ...
0
votes
1answer
109 views

Is it possible to override this function/class in a child theme?

Is it possible to override this widget function from a parent theme? I saw this blog, but it dealt with a simpler case. http://venutip.com/content/right-way-override-theme-functions parent class ...
0
votes
0answers
38 views

Run a Wordpress function inside a wp_query loop result [duplicate]

I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The ...
0
votes
1answer
37 views

How to load plugin before the wordpress jquery?

I'm fixing a wordpress plugin that uses a 1.0.0 version of jquery. The jquery version automatically included in wordpress is 1.11.0. In a test site, the plugin is dependent on the 1.0.0 jquery and ...
0
votes
1answer
40 views

How to add a piece of code in function

On the function below, after echo '</span>';, I want to add this a piece of code: &nbsp;<a href="<?php $key="link"; echo get_post_meta($post->ID, $key, true); ?>" ...
0
votes
1answer
51 views

Remove echo from shortcode

I've just started playing with shortcodes and due to my lack of php knowledge I am unable to figure out how to make this shortcode work without using php echo. Can anyone help me revise my code? // ...
0
votes
1answer
74 views

Warning: join(): Invalid arguments passed in post-template.php

I'm getting this warning with development mode: Warning: join(): Invalid arguments passed in /webDir/project/wp-includes/post-template.php on line 371 In production mode the <article> ...