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

Removing all my hardcoded URLs with get_site_url()

In my php files, I would like to remove all my hardcoded URLs (ex: http://mysite.com/) and replace them with the get_site_url() function. My problem is with the php code of one of my functions (in ...
0
votes
0answers
48 views

Why WP_Query in functions.php is not working when get_posts works?

I have following code in my functions.php. When I try to add new post_type (e.g. post,lawyers) it fills excerpt,slug (this affects in permalink structure), other metaboxes from first post of lawyers ...
0
votes
1answer
34 views

Is there a WP function to get taxonomy name from taxonomy_term_id?

I need to get the taxonomy name from the taxonomy_term_id. I am currently using the following to get it: global $wpdb; $term_taxonomy_table = $wpdb->prefix . "term_taxonomy"; $taxonomy = ...
0
votes
1answer
29 views

Fatal error after changes to functions.php, even with original file

Getting Fatal Error: Cannot redeclare theme_feature_setup() message after code changing in the functions.php file. I've tried deleting functions.php file and uploading the previous version but I still ...
0
votes
1answer
19 views

Make WordPress search for only this tags or exclude certain tags from search [duplicate]

Is there something like a function for letting the WP search form search for ONLY some tags you fill in. in example: function wordpress_search{ //search for tagname1, tagname2, tagname3 } If ...
0
votes
1answer
46 views

A blank page is shown after I add a Function

I am redesigning a template. So I am trying to show a holding page till the redesign process is done. I ever used following function for the purpose on many other projects and it's redirected to the ...
-3
votes
1answer
27 views

Adding function to function.php error 505 [closed]

Whenever I try to edit the function.php file of my theme. I get an 505 Error, no matter what function I add it will always give me that error.
0
votes
1answer
44 views

Sanitize slug title

i need to convert this strings into the post url: (numbers with the point and € symbol) ex: 9.000€ -> 9000-euro I found this function but is not working: add_filter( 'sanitize_title', ...
1
vote
1answer
31 views

Logout and redirect using the WP Menu

I have a navigation hyperlink in my secondary menu, that will allow the user to logout: However, the user is prompted with the following screen for confirmation, when clicking on the hyperlink in ...
1
vote
0answers
39 views

Wordpress Custom field Colors

I came across this code and would like to use it in my project. It works fine, but the problem is, I need to change those colors in the array to instead pick transparent images from url since I am ...
5
votes
2answers
62 views

Remove Actions/Filters added via Anonymous Functions

That's a freaking bad practice I must say. Spent last two hours finding a solution to remove actions and filters added via Anonymous functions. This is the code used on a Parent Theme, and I need ...
1
vote
1answer
51 views

Common functionality between my own plugins

I read that when creating new post types, creating a settings page, and creating a new taxonomy, you should create a plugin. So I have done that. But I have functionality, which could be generalized, ...
-2
votes
1answer
68 views

Wordpress: code structure

EDIT: I've posted them separately here wordpress.stackexchange.com/questions/137672/… and here wordpress.stackexchange.com/questions/137673/…. I'll vote to delete this one. I'm working on a Wordpress ...
0
votes
0answers
33 views

Hide Password Protected pages in Recent posts

I have the following lines of code in my functions.php file: // Filter to hide protected posts function exclude_protected($where) { global $wpdb; return $where .= " AND ...
0
votes
0answers
56 views

Customize Breadcrumbs - home -> page -> childpage -> post

I use this snippet for breadcrumbs, and it works well, but not as i need it. function test_breadcrumbs() { if(!is_front_page()) { echo '<nav class="breadcrumb">'; echo '<a ...
0
votes
0answers
9 views

transition_comment_status called when untrashing comments [duplicate]

The author gets two mail when I untrash a comment. I only want to send the "untrash_answer_notification"-mail when untrashing comments. Any ideas? // Send mail to user when their comment has been ...
0
votes
1answer
56 views

Display Buddypress notification bubble on single menu

I am trying to get the Buddypress notification bubble to appear in one of my two navigation bars. I was given this code to place in my functions.php which does everything, except it displays in both ...
0
votes
0answers
6 views

Archive list with only years and months belonging to a category

I need to generate a list of years and months belonging to a category. For example I have two main categories (A and B). I need a list of years and months of post published only of the category A and ...
0
votes
1answer
35 views

Calling the Next category link on an archive page - Wordpress

I've been working on creating a link in my header, should say "see enter next category name here" I've been using this code, found here (I would comment again to ask directly on that question, but ...
1
vote
1answer
46 views

Global functions on WPMU

I work in a multisite environment where all of the sites are related. A lot of recent developments have required me to copy and paste certain functions into many different theme folders, which causes ...
0
votes
1answer
39 views

Add login hyperlink to secondary navigation menu

I have the following lines of code in my functions.php file: #-----------------------------------------------------------------# # Custom menu ...
0
votes
2answers
117 views

wp_enqueue_script was called incorrectly

Hello I don't know how but now I am getting this error Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, ...
0
votes
1answer
21 views

Connecting to a 2nd DB gives me no results when querying

I'm trying to access a different DB on the same localhost as my wp db is and I did this like so: functions.php: add_action('init','my_new_db'); function my_new_db(){ $newdb = new wpdb( 'test', ...
0
votes
2answers
46 views

Override default password nag in Wordpress

For some reason my default password nag is playing up on a big multi-user site I've setup. Pretty sure it's got to do with the New User Approve and Gravity Forms User Rego combo that I'm using. ...
0
votes
0answers
26 views

Adding ID to a Listing but not inside WP_Query while

<?php $args = array( 'post_type' => 'bedrijf', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC' ); ...
3
votes
1answer
67 views

Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?

I am looking for solution to auto delete images of old posts in WordPress site. I want to hold images of current 50 posts, others should be deleted automatically. It can be function to delete on time ...
1
vote
1answer
25 views

wp_trash_post function to only apply to posts, not pages!

I have the following function that deducts at point when a post is removed. But when I remove a page, the wp_trash_post is also called. // Remove 1 point if their post get removed function ...
0
votes
1answer
27 views

Foreach loop returning more than one item when querying taxonomy

I am querying the taxonomy terms and then listing the posts that are under those terms. The taxonomy is basically a category for a custom post type, and the terms in it are the categories. I didn't ...
0
votes
2answers
67 views

How to use scripts when header/footer are stripped out

I'm working with a client who is wrapping the body of our WordPress site with their own external header and footer, stripping out our header and footer. Our enqueued plugin scripts then, aren't ...
0
votes
1answer
62 views

Strange error from functions.php files (wp_register_script)

I'm trying to migrate a wordpress site, and i'm receiving this error when debugging on the new server: Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered ...
0
votes
0answers
24 views

Can't change local language with function

I'm trying to add a function in my theme to change the local language for certain pages. function nfo_redefine_locale($locale) { global $locale; $locale = 'de_DE'; return $locale; } ...
0
votes
1answer
25 views

Add Element as a Filter to the_content

Can I and How would I add a filter in the function.php that would add a HTML element around the content when the_content is used? This would be similar to what you can do with the_title. i.e: ...
0
votes
1answer
73 views

How to change featured content to a different tag in Wordpress Twenty Fourteen

In twenty fourteen theme, we’d like to know how to change the features content tag. Currently it’s set as featured. Now, we would like to know how to code this for different page templates. We ...
0
votes
1answer
31 views

Rename Default Category (Uncategorized) Via a Function

I'm looking for a function to rename the default 'Uncategorized' category. The reason I need this is because I'm running a WordPress multi-site largely used by users with little technical knowledge ...
0
votes
1answer
32 views

Wordpress theme showing blank page

Something is wrong to my installed theme, because when I am clicking on Visit Site than its showing blank page. No error and no content, no navigation nothing to display. There is link below :- ...
1
vote
1answer
66 views

Pulling Twitter RSS feed not working as expected (fatal error)

I'm trying to get some of the latest posts from a Twitter account, without a plugin. According to Botcrawl.com's tutorial, this should be enough: <ul> <?php include_once(ABSPATH . WPINC . ...
0
votes
1answer
43 views

Enqueueing a code block from an options framework

I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global ...
0
votes
1answer
60 views

Change custom post type slug from plugin options

I'd like to give users the option to change a custom post type slug in my plugin. Using this answer, I'm able to hardcode it into a function: Redeclare/Change Slug of a Plugin's Custom Post Type ...
0
votes
0answers
17 views

Exclude a category of posts from all listings if user doesn't have a role

I have some categories that I'd like to bulk exclude from all listings (the loop on the main blog listing page, category listing pages, archives, etc.) and to show them only to users with a specific ...
0
votes
1answer
42 views

Modify function Shortcode_atts

function get_date_posts($params, $content){ $default_params = array( 'post_type' => 'post', 'order' => 'asc', 'orderby' => ...
0
votes
1answer
63 views

How to load jQuery in the footer - nothing works for me

I tried all the solutions I found on the internet, including the ones I found here, but nothing works on my theme - jQuery always load in header. I try to use the one from Google, but I would be happy ...
3
votes
1answer
51 views

How to Loop Plugin Option Field Set?

Problem/Background Currently, I'm creating a plugin for a client that will enable them to mark and modify predetermined Google Map polygons (displayed on the site) in the dashboard. I want to let ...
0
votes
0answers
42 views

Creating custom theme options page

I am creating a theme for a client and it has a custom front page that has a slider and displays the services they offer. I am looking to add an options page where the client can easily update the ...
0
votes
1answer
29 views

edit formatting.php in a theme so it wont get overwritten

There are some parts of wpautop I want to remove, but keep the rest. I found in wp-includes/formatting.php within the function wpautop: $pee = preg_replace('|<p>\s*</p>|', '', $pee); // ...
0
votes
0answers
10 views

Creating a custom abstract/excerpt function: retrieving text between a specific tag or id

Unfortunately, the functions for retrieving the abstract and the excerpt don't fit my needs. I want to define a part in my text that should function as abstract without falling back to ...
0
votes
0answers
29 views

Cant use php fopen() function in functions.php

I am trying to simple run fopen() in the functions.php, and have also tried it in a test.php wordpress template file. But it does not work. If I move the test.php file and csv file to a location ...
0
votes
1answer
26 views

Allow tags and attributes in post and pages content

I am trying to allow the "onclick" attribute on links as well as some html tags such as iframe to the content displayed in posts and pages. In my theme's functions.php file, I tried removing ...
0
votes
0answers
39 views

Wordpress 2014 Theme - Featured Content with multiple tags?

My company is using the new 2014 Theme for our portfolio blog. We really like the Featured Content section on the home page. What we would like to do is have multiple pages all with different ...
0
votes
0answers
36 views

WP E-Commerce: include custom meta value in product search

I'm currently using the WP E-Commerce plugin to integrate e-commerce into a site I'm building, this all works great but I've also added a custom meta value to the product page, the small problem I'm ...
-1
votes
1answer
72 views

Hueman layout styles and custom post type (DW Q&A)

I'm running a wp site with the Hueman Theme and the Q&A plugin from DW. The theme doesn't really plays well with the theme, so I had to find some solution for it. Managing the is somewhat painful ...