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.
2
votes
5answers
214 views
Allow users to add custom functions to wordpress theme
I'd like to allow users to add functions to the theme I'm developing, but don't want users to change functions.php directly, as this file may be updated with theme updates. In other words, I'd like ...
0
votes
1answer
64 views
How to add an admin function only to posts, not pages?
I'm having a problem with adding an excerpt counter to the excerpt field. It may be a conflict with another plugin, but basically it screws with other jquery if the excerpt field doesn't exist (e.g.: ...
0
votes
1answer
33 views
Dashboard blocker on network multisite for specific user roles
I have used this function below for a while now on normal WordPress installs.
It simply blocks users with specific user roles, and redirects them to the home page of the site.
function ...
0
votes
2answers
61 views
How to override core is_ssl() function?
I am looking to override a function in functions.php through a theme or plugin. Specifically, is_ssl(), which does not have any filter or action hooks. Obviously, the easy why would be to update ...
3
votes
2answers
137 views
Safe to disable wptexturize?
To optimise the speed of my platform (beyond caching, database optimisation, JPEG compression, CSS sprites etc), it has come to my attention that disabling the wptexturize() function may give some ...
1
vote
2answers
209 views
Custom gallery in wp3.5
I used a tutorial I found for a slick little custom gallery in 3.4, but upon upgrade to 3.5 it no longer works. I'm trying to learn php still and can't seem to get this working again, as I either get ...
2
votes
0answers
125 views
wp-admin won't load after setting wp-login custom url
I changed the wp-login.php url to /login/ so all links in registration and forgot password emails have /login/ rather than wp-login.php.
The problem now is that when I visit /wp-admin/ or click on ...
1
vote
1answer
202 views
Login/logout in header
I am looking to move the login / logout / my account / register details currently
situated under my menu bar to above the menu bar.
Essentially I want to add the details just after the header.
What ...
0
votes
1answer
98 views
Adding a 'style=' bit to image_send_to_editor output
The best thing I liked about the new v3.5 media manager was being able to insert images to a post hosted by an external site like photobucket using "Insert from URL". I normally format my image ...
0
votes
1answer
447 views
How to display error messages using WP_Error class?
I have registration form code in my functions.php file like this
if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'registration') {
...
1
vote
0answers
42 views
Need help enqueueing webfonts
I am attempting to enqueue web fonts that I am loading in via the WebINK font library. (This service is similar to Typekit). This service works by generating a unique CSS link for each unique site. I ...
0
votes
0answers
22 views
How to pass CLASS function with arguments to add_action? [duplicate]
Possible Duplicate:
Passing a parameter to filter and action functions
This works:
add_action('hook', array($this, 'someFunction'))
These not:
add_action('hook', array($this, ...
0
votes
1answer
39 views
Can't get custom user meta to show in header
I have used Pie Register plugin to add a "Phone" field.
I tried every method in the book (that google fetched for me, so far) to show it but it shows an empty array although the field is not empty ...
2
votes
1answer
26 views
How can I get an <h2> tag to wrap each ancestor that gets outputted in this condition?
I found this snippet in a different thread and it mostly does what I need, but I'm having trouble wrapping the individual pages this outputs with tags. All I can seem to add is a line break. I don't ...
0
votes
1answer
58 views
Auto log in hook is requiring a page refresh
I have a simple auto log in hook that looks like the following:
function auto_login() {
if (!is_user_logged_in()) {
//Removed some code for brevity.
$user = ...
3
votes
1answer
256 views
Logout/login redirect CSS issue
I'm using WordPress Multisite. When I use wp_logout_url(), I get redirected to the login page but somehow I end at a different login page without any styles applied
<a href="<?php echo ...
2
votes
1answer
72 views
How can I list random authors from current post category?
The following lists authors of the current category.
But I want this to be a list of 6 random authors from current post category.
foreach((get_the_category()) as $category) {
$postcat= ...
0
votes
0answers
47 views
Function to hide wordpress theme's wrapper [closed]
I am trying to hide the main div containing the theme in my wordpress. I am just testing something. I can simply use css to display none the div, but some themes have the wrapper with a different id ...
0
votes
1answer
152 views
Custom registration form in shortcode getting internal server error 500
I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below
/* Custom shortcode */
function ...
0
votes
2answers
165 views
can you set a default value to a custom field
I'm looking to set a default value to a specific custom field, in case the client doesn't add into the custom field it already has a specific number associated with it.
one step deeper, I'd like it ...
0
votes
1answer
461 views
Change ul class=“children” for wp_list_pages?
Hello I'm using this code to print a list of Pages and Subpages:
<ul>
<?php wp_list_pages('title_li=&depth=2&child_of='); ?>
</ul>
It outputs:
<ul>
...
0
votes
1answer
296 views
Using wp_get_image_editor in a standalone script
With WP 3.5, they updated the image resizing scripts with wp_get_image_editor.
Currently, in this standalone script that is accessed with Ajax, I have included wp-load.php so I can access all of the ...
1
vote
1answer
67 views
Does WordPress Development Mode Exist (with not minified JS)?
A lot of WP JS is minified and therefore it's hard to be analyzed in the Console. Is there any way to have all scripts uncompressed?
0
votes
2answers
61 views
How can i call from custom fields to the category editor?
I found this code for custom field add category editor.
I added custom field to the Category.
e.g. My field name is Hastag and i have a Sport category. And i want to call display Sport's custom ...
2
votes
1answer
39 views
Actions according to image type and size
I want to do some actions according to image type and size, but the script I'm using is kind of heavy and is skyrocketing my wait time (first byte) from 5 to even 40 seconds (usually it's bellow a ...
0
votes
2answers
46 views
Shortcode of a function
I got this function and i want to make the contents divs of "foreach" as return. How can i do that?
<?php
$args = array( 'numberposts' => 6, ...
6
votes
2answers
116 views
Memorizing syntax
I hope the following question is acceptable here.
I rely entirely on copy/paste for most WP functions, however I guess WP veterans don't. Is it important to know by heart the common WP syntax, and if ...
0
votes
1answer
56 views
How can i listing current category and Featured Category post list?
I have a Featured Post Category. Im marked some post Featured. When i viewing a category page(e.g. Sport), i want to list on sidebar both marked post list (e.g Featured and Sport,)
I tryed with that ...
2
votes
1answer
117 views
Post thumbnail relative link and HTML modify
I want to remove the website url from all the_post_thumbnail() so they become relative and remove/add attributes from the output.
So far I got the following code added to functions.php of the theme, ...
0
votes
1answer
53 views
How can i list random author?
Im listing current category of all author list but I want to list random author list from current category.
I was try 'order' => 'RAND', RAND code its not worked.
My Code:
function ...
0
votes
1answer
91 views
How to place a div inside a function that creates a div
I am wondering how instead of having the menuTab div come after the bones_main_nav function html code that is outputted to have it injected inside of it I suppose.
I have the following function
// ...
1
vote
2answers
186 views
Hide main div if wp_nav_menu is empty
I want to hide the div class "navmain2" if the menu is empty. See code below:
<!-- Start main navigation -->
<div class="navmain2">
<div id="logo"></div>
...
-2
votes
1answer
307 views
how can I hide the label 'reviews' on each product tab in woocommerce" [closed]
I do not want to edit the .php files. I want to add css code display:none to hide the wording reviews on the product tabs. What is the name I tell css to display: none?
0
votes
2answers
144 views
Apply post formats to a specific post type only?
I have the following code in functions.php to give me post format support and a custom post type 'photos'. But I would like the post formats to only apply to the 'photos' post type and not to the ...
-1
votes
1answer
75 views
Notifications Bar on home page only
Is it possible to create an "Alert" button that can be turned on and off thru wp-admin.
Of course the "Alert" button im asking for is to be published at the main page, but can only be turned on when ...
0
votes
2answers
150 views
How to add an excerpt and read more link to a page?
I've a custom/static "homepage.php" in my templates directory at my WordPress. Now I need to show differents "page excerpts" in my homepage, but I don't know what should be do it.
At this moment I've ...
0
votes
2answers
77 views
can not call functions in function.php
In front-page.php I have the following code:
<span class="amountOnline">
Online:
<?php echo $cbMain->GetInfo()['Players'] . '/' . $cbMain->GetInfo()['MaxPlayers']; ?>
...
0
votes
0answers
88 views
Cleaning up the template [closed]
I have an interesting template here - Underfire. Functions.php is a bit different than I´ve seen before.
<?php
/**
* web2feel functions and definitions
*
* @package web2feel
* @since web2feel ...
0
votes
1answer
147 views
Make wp_link_pages() suitable for Twitter Bootstrap markup
Below there's the Wordpress code found in post-template.php for the wp_link_pages() function - this function generates a page navigation for posts or pages having the content split into multiple ...
0
votes
1answer
107 views
How to detect first visit of a user?
I want to build an alert for users who visit my WordPress blog. Is there a conditional function like is_home() to detect if someone visits the blog the first time? I want to send the alert to every ...
0
votes
1answer
50 views
Echo post title in post
I am looking to echo the post title at the beginning of each post. I've tried adding the following to functions.php with no luck:
function add_post_content( $content ) {
if ( ! is_feed() ...
0
votes
1answer
165 views
How to update BuddyPress xprofile fields programmatically?
I update user info using wp_update_user function. I also need to update the table wp_bp_xprofile_data. Is there any function, where I can update data on wp_bp_xprofile_data table?
0
votes
1answer
53 views
Post Views Code Hacks
// Post views
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
...
0
votes
1answer
20 views
Closing WP_LINK_PAGES DIV ID w/After Argmuent
In my code below I need to close the div "link_wrap" which I created with $args['before'] = '<div id="link_wrap">';
When I try to paste $args['after'] = '</div>'; above return $args; it ...
0
votes
1answer
66 views
How can i list current author's categories?
My Code getting authors written post categories but just 2 ID has author lists category.. I replace $current_user->ID but it is not worked.
<?php
$categories = $wpdb->get_results("
...
0
votes
1answer
67 views
Wordpress get_avatar function not correct working
My code doing this, listing which author have posted in the current category. But get_avatar function not correct working. Im Using Simple Local Avatar Plugin. It is working author.php don't have any ...
0
votes
3answers
53 views
Need help “sanitizing” a custom function that pulls category slug into body class
Not sure if "sanitizing" is really the correct phrase to use for this but it was the best one I could think of...anyways, here is the problem:
My function works great like so...
// add category id ...
0
votes
1answer
46 views
How to list posts that appear in two categories
I would like to list all posts that appear in the current category being viewed that are also posted to a second category.
Example Pictures : LINK
For instance, a listing of the common posts between ...
-1
votes
2answers
51 views
Wordpress list the author of the category
How can i list the author of the category? (Wordpres)
My blog have three author and i will list who written post in a category?
For example:
CAT NAME: INTERNET AUTHOR: JOHN, DOE, ALEX
CAT NAME: ...
0
votes
1answer
57 views
Unable to Change “Pages:” Before WP_LINK_PAGES
Below is a functions.php code for wp_link_pages which allows pagination and previous/next links to be displayed. It also wraps each pagination link in a span class called "classlinks".
I need to ...



