The server-side programming language that the WordPress core, plugins and themes are written in.

learn more… | top users | synonyms (1)

4
votes
4answers
4k views

Where to get information about array fields in $_REQUEST?

I just started to learn PHP and doing things with WordPress and I am a bit confused about information in Codex. Was told that Codex got all info I required but I got stuck with it. What array fields ...
0
votes
1answer
248 views

Pagination not working

$paged for pagination is awlays returning 1, so no matter what page i click "1" is always highlighted and it always shows the same posts. i have tried a million different combinations of things to fix ...
0
votes
1answer
575 views

Move wordpress sidebar on homepage up to new position

This should be a simple task, however I am having no such luck. I am using a theme that has a homepage slider which spans across the entire content area. I have been asked to reduce the size of the ...
0
votes
2answers
187 views

Seriously stuck with some custom meta box/plugin stuff

I’m working on a small plugin - part of it needs to add several meta boxes to all custom post types. I’ve tried looping through my array of custom port types in various ways but I keep getting errors ...
0
votes
1answer
76 views

Wordpress doesn't load HTML

All, I'm trying to have a side navigation menu that once you click on a link it basically pulls the content of that wordpress page and displays it. I've got the following code to do this: $qry = ...
0
votes
3answers
1k views

Add class to every other posts using get_posts

I am currently using this little loop to display a list of posts using the "events" custom post type <?php global $post; // required $args = array('post_type' => 'events'); ...
1
vote
1answer
7k views

How to call a function only once (global variable scope)

I have been trying to work out the most effecient way to use functions in WordPress. I have a big slow function big_slow_function() that ideally is only run once. But I need to use the boolean that ...
0
votes
2answers
3k views

Pagination Not Working (pages duplicating content)

My pagination pages echo out the same content on every page. Page one is queried to show two posts, which it shows up correctly. Page two shows the exact same two posts as page one does. Here is my ...
0
votes
1answer
104 views

How can I print out a single stylesheet or javascript link?

I know I can use enqueue_script and enqueue_style to register scripts and stylesheets, however I'm trying to print out just the link to the adminbar css: <link rel='stylesheet' id='admin-bar-css' ...
0
votes
3answers
93 views

Functions.php and includes

My functions.php file is getting on the long side. Is it all right to use includes to break it up (php includes I mean) or is this considered bad form?
0
votes
1answer
394 views

How can I use a sliced image As banner? [closed]

I am giving a try to something i have never done before. I am trying to slice a psd file and want to use it as a banner. But the problem is, as you may already know that, wordpress only allow one ...
0
votes
2answers
191 views

Show a different code on front page to other pages

I'm looking to display a list of posts in the header section on my template on all pages with the exception of the front page where I would like to show an image in place of the list of posts. Is ...
0
votes
1answer
168 views

PHP Syntax Error on get_posts

I have the following coding: <?php global $post; $args = array( 'numberposts' => 8); $myposts = get_posts( $args ); foreach( $myposts as $post ) : ...
0
votes
1answer
1k views

How to Use the Function is_user_logged_in To Display Different Menus?

So, I want to create different menus for people who are logged in or not. I got a reply that i should use a function if (is_user_logged_in()) { wp_name_menu(array('theme_location' => ...
0
votes
1answer
669 views

How to create different menu's for not logged in visitors and for logged in members?

I'm creating a website which will provide services to members and I want to make it so that when a not logged in person comes to the website the menu is specifically designed for sales pages to make ...
0
votes
1answer
123 views

How to make number of blog posts a custom field?

I'm using advanced custom fields and I have the following code: <?php $args = array( 'numberposts' => 3 ); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ...
0
votes
2answers
342 views

Get 'Headers already sent' error for the plugin I am creating when I try to login

I am trying to create my first plugin. So far it actually works fine but for one error: I get a 'Headers Already Sent' PHP message when I try to login to wp-admin. If I remove the plugin file from ...
0
votes
1answer
635 views

Dynamically change Custom Post Type Template OR Change Permalink?

I have built a plugin that uses a custom post type and a single-.php file for a template. My issue is the custom post type template needs to take on the name of the post type and I need to change ...
0
votes
1answer
30 views

Wordpress Related Plugin - Adding an image

I'm using the Wordpress related plugin which is great but I would like to display the feature picture of the page. It mentions on http://wordpress.org/extend/plugins/related/installation/ about using ...
0
votes
1answer
85 views

Determine if only one image attached to a post/page

I'm looking to determine how many images are attached to a post, specifically if there is only one. Basically if there are multiple images I want to display my slideshow script, if there is only one I ...
-1
votes
1answer
713 views

Inserting a shortcode into a genesis menu?

I'm trying to insert a shortcode as the last item in a menu but it results in creating the <li> but then throwing the shortcode output elsewhere, outside of the list. It also removes the closing ...
0
votes
1answer
245 views

Use of antispambot with $curauth->email

This is probably pretty simple, but... I want to use the WP function antispambot not on get_the_author_email but on a value in a field I added to User Profile called publicemail. Everything I've ...
0
votes
1answer
208 views

the_post(); prints out style text into my HTML?

Every time I use the_post(); in my theme code, the following is echo'ed into my pages: <style type="text/css"> <!-- .formTitle { font-size:20px; font-weight:bold; ...
4
votes
2answers
107 views

How does wordpress know which site to setup (on multisite)?

Ok for subdomain it's easy. I guess it just looks up the subdomain: blog5.site.com => explode('.', $_SERVER['REQUEST_URI'])... But how does it do it for sub-directory setups? This should be ...
11
votes
4answers
22k views

How to manually fix the WordPress gallery code using PHP in functions.php?

It's been talked many times that Wordpress outputs some really bad code for the built-in gallery function. This is the core code responsible for the gallery output (in /wp-includes/media.php): ...
2
votes
1answer
54 views

Output data like WP's plugin installer/updater

I want to update my plugin and have proper feedback, like the WordPress update/upgrade mechanism. How is this effect done? Essentially I have a script I want to run that has lots of processing, and ...
0
votes
2answers
344 views

persist a variable set in header.php all the way down to footer.php

I look up a custom post field value in header.php, and store it in a global variable. In most of my template files, the includes go like this: include header ...do a bunch of stuff include ...
0
votes
1answer
77 views

Wordpress Related Plugin - only show when related content

I'm using the Wordpress related plugin : http://wordpress.org/extend/plugins/related/ Which uses the following markup to call the plugin: <?php echo $related->show(get_the_ID()); ?> I ...
0
votes
1answer
71 views

Converting Menu Links to List Elements

I'm creating a theme from a template based on Wordpress 3.0. I've started with items like Starkers which is a completely bare theme, and even tried modifying something by default like Twenty Ten or ...
0
votes
1answer
1k views

Echo title attribute php

I have the following in functions.php: function twentyten_continue_reading_link() { global $id; return ' <span class="readmore"><a href="'. get_permalink($id) . '" title="' . ...
1
vote
1answer
781 views

PHP code to use on next & previouspage links

I'm having an issue with wp_link_pages tag. I want to list the number of pages of each post with 'next' and 'previous' links that are two image arrows. To better understand the problem I'm having, ...
0
votes
1answer
1k views

how to include a simple jquery file into a wordpress plugin

ok this is my first time to include jQuery into wordpress and it has taken me the 2 full days trying to figure this out. No matter how many articles I read I cannot find a perfect example. Ok so this ...
0
votes
2answers
596 views

How to include this jQuery File in wordpress?

Ok I have this jQuery that I have tested in a static html page and it works fine. How would I include jQuery to work on wordpress in a plugin? So this is the html page. <head> <title> ...
0
votes
1answer
1k views

Emdedding PHP in shortcode $content

I have created an enclosing shortcode that is styled to be a button with the intention of putting content in it. I am echoing this shortcode inside a theme file and want the content to link to a ...
1
vote
1answer
699 views

Customising the search function?

I'm rebuilding this website - http://www.mediwales.com/news on the WP platform. I'm struggling with the search area in the grey box. I'm removing region and date so we don't have to worry about ...
2
votes
1answer
229 views

Step through wordpress code

I was wondering if anybody knew how to setup step through code for Wordpress. I have tried xdebug but had no luck setting it up on my VPS. I managed to get it working on my localhost at one stage but ...
5
votes
1answer
2k views

How to make simply “report” button on posts

I'm building up a video-site using wordpress. It embeds videos from different sites. I really need a simply "Report broken video"-button that saves the url in a database or emails it to me. I've ...
-1
votes
2answers
481 views

Different Output for “Every Other” Foreach Statement?

I'm currently using the following code in order to get subcategories in a category page and getting the posts foreach subcategory. In the part where it echos "span-12" (line 14) i want it to echo ...
19
votes
7answers
70k views

How to retrieve the slug of current page?

I am trying to retrieve the slug of the current wordpress page outside the loop. The title of the page returns with wp_title () but how can I get the slug? <li><a ...
37
votes
5answers
26k views

What are PHP extensions and libraries WP needs and/or uses?

Codex loosely only mentions PHP version in server requirements, however PHP can be configured in pretty wide range of excluding/including different parts. What are extensions/libraries that: are ...
7
votes
1answer
1k views

Wordpress Admin Bar pushed Sticky Footer off the bottom of the page

I've implemented Ryan Fait's oh-so-common sticky footer in a custom Wordpress theme. I've noticed now if I implement the Wordpress Admin Bar into my pages, which is 28px high (in current Wordpress ...
2
votes
2answers
1k views

plugins_url() incorrectly returns a url with www subdomain

I'm working on a plugin which we'll call "my-plugin" for the purposes of this question. The my-plugin directory looks like this: my-plugin/ |- image.jpg |- script.js |- script.php |- plugin.php ...
1
vote
1answer
317 views

Generating add_settings_section() calls dynamically

I have some pieces of code within functions.php that I could easly replace with much shorter functions, like, for example: function register_sections() { add_settings_section('SOMETHING_settings', ...
0
votes
1answer
467 views

Help solving t_echo php error while using echo do_shortcode

I am using the Orbit Slider plugin successfully on my site. The plugin supports its own categories. I would like to embed the slider within my page.php template but allow each page to have it's own ...
0
votes
2answers
798 views

Hard-coding a shortcode as the last menu item in primary navigation?

I have Genesis framework installed with a child theme. My client wants their themes "shopping cart" shortcode to be the last menu item, in their primary nav, no matter how many menu items there is. ...
0
votes
2answers
915 views

Cannot Upload Custom Header Image into Wordpress Dashboard

I'm having trouble uploading a custom image into Wordpress' dashboard. It says that it needs to be a custom 1000x288 image. When I upload it, I get the error of: Warning: ...
0
votes
2answers
2k views

Wordpress: Remove link in the_tags

How do I remove the link generated by the_tags? This is what I use today: <?php the_tags( '', '', '' ); ?> That results in the tags assigned to the post. But I want to remove the link. Any ...
0
votes
2answers
215 views

Showing latest post without 301 redirect

My WordPress website is now redirected to latest post by adding below function to function.php add_action( 'template_redirect', 'redirect' ); function redirect() { $args = array( ...
2
votes
2answers
7k views

Proper use of Output Buffer

I'm attempting to use actions to override function calls I currently have throughout a template (to make updating certain replicated sections easier). For example, in archives.php I have the ...
0
votes
1answer
1k views

How do I attach an invoice PDF to an email in the Dukapress plugin for Wordpress?

I'm using the eCommerce plugin Dukapress for my WordPress website. I want to attach the invoice PDF to the admin's email, but I'm not sure how to go about this. I'm under the impression that the only ...