Questions tagged [php]

For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.

Filter by
Sorted by
Tagged with
0
votes
1answer
3k views

how to edit wp category widget

how to edit wp category widget, so it would not show one of specified category? For example, it shows all categories in list, and I need to remove category Books, from it, how can I do it? Best ...
-1
votes
1answer
4k views

how to get category name if my category got custom slug

so my category got slug 'aeroplanes' and I need to get category names from it, but I can't get it with $category = get_the_category($post->ID); echo $category[0]->cat_name; cause it takes ...
-1
votes
1answer
173 views

Implement “No related posts for this entry” into the loop?

For my related posts I have set up a scrollable container. I need the HTML to be outside of the loop or otherwise the layout will be a mess if there are no related posts to display (missing divs that ...
2
votes
2answers
228 views

WordPress 2.8.5 & 'Responsive Twenty Ten' - error

So, According to the WordPress theme download page; the theme 'Twenty Ten' and it's child theme/plugin 'Responsive Twenty Ten' are compatible with 2.8+ I'm stuck with using 2.8.5 at work, I don't ...
0
votes
2answers
287 views

Modify pages widget and make a plugin?

I would like to make a plug-in that adds a widget. I would like it to be based on the current pages widget but add the ability to select either include OR exclude by drop down or checkbox then list ...
-1
votes
2answers
465 views

Im using a right approach to use this class inside WordPress theme?

I'm using a class to retrieve values from custom tables that I need to use in different files of my WordPress Theme and im not sure which is the best approach for this. This is the class i got right ...
1
vote
2answers
490 views

Can you run Wordpress on a MarketLive/Java EE server?

I am using MarketLive. I want to install Wordpress into a subfolder, but the person I'm speaking with says they can't do it because my site is built in Java. I want to install wordpress on my domain ...
0
votes
1answer
455 views

“operation successful” message

i'm writing some custom wordpress pages, and i want that after an action where the user has addess an item to a list (after the user press the submit button and the page reloads showing the updated ...
0
votes
3answers
2k views

Custom Database Table and foreach

I have just created a custom database table and would now like to output every inserted row from it into a predefined format using a foreach statement. Some guidance in this matter would be great. ...
0
votes
1answer
327 views

Showing author box on post detail page

Being new to word-press as well php i am struck at a point. I am trying to display author information along with his picture in the post and have successfully able to fetch all the data from gravatar....
0
votes
1answer
516 views

display sticky post outside loop and exclude from loop

I have a "featured" area in header.php that displays the content of the latest sticky post: $last_sticky_post = get_post(end(get_option('sticky_posts'))); if(!empty($last_sticky_post)): ...
1
vote
2answers
121 views

How can I include PHP-Code to my post?

I would like to use PHP in some posts. These posts should look like normal posts, be in the archive and categories like normal posts an have tags. I don't need PHP in every post, but it would be ...
1
vote
1answer
235 views

Adding Custom Forms

I'm looking to create a page for a wedding site that will have a form. The idea is that it is an RSVP page where a visitor will input a unique string that was on the invitation that they received and ...
0
votes
1answer
503 views

Can you echo PHP code from a variable?

Ok this is a stupid question, and I'm not sure I even asked it right, but this is what I'm trying to do. My wordpress theme supports ad placements and I want to use a advertising manager plugin. I ...
2
votes
1answer
3k views

wp_enqueue_style with style.php and Wordpress functions

I use wp_enqueue_style to add my stylesheet, like this: <?php wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.php', false, '1.0', 'all' ); ?> It works fine BUT I need ...
3
votes
1answer
2k views

Wordpress custom taxonomy description for each post?

In a Wordpress blog, I'd like to put the term description of a specific custom taxonomy in the footer of each article. Is this possible? I've tried <?php term_description( $term_id, $taxonomy ) ?...
0
votes
1answer
62 views

WordPress: Create A Widget to Accompany Plugin

So I have a plugin that I've created for the admin are when creating post... and I'd like to supply a widget along with it. I'm trying to figure out the best way to initialize my widget. I'm ...
5
votes
1answer
3k views

Is there a way to parse shortcodes in PHP?

Many plugins don't provide a documented way to access their functions from within PHP (e.g. when building a custom theme), but only shortcodes to insert in posts. Is there a standard way of executing ...
1
vote
1answer
13k views

Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin

I'm trying to write to an XML file in a WordPress Plugin. I'm on my local machine, a Mac running MAMP. I have PHP 5.2.13 My code is: $file_handle = fopen('markers.xml', 'w'); $stringdata = "Test ...
0
votes
1answer
302 views

Use Wordpress Text Editor in non-wp page

I have a page that is completely custom and does not fall into the Wordpress structure. However it is using data from the WP database. To access this I've used: define('WP_USE_THEMES', false); ...
0
votes
2answers
219 views

Warning: Cannot modify header information (with a twist)

Warning: Cannot modify header information - headers already sent by (output started at /home/ezekiel/public_html/boxsponsive/wp- content/themes/BoxSponsive-Portfolio/class.wp-less-styles.php:3) in /...
0
votes
1answer
660 views

Can 'Custom Field' data be inserted into this Short Code?

I have created a custom page template. In the template, I use a shortcode for JJ NextGen JQuery Slider. I would like the page to have a 'custom field' called 'Image Gallery' with a value that derives ...
2
votes
2answers
3k views

WordPress Custom Page Template in a different directory

Is it possible to have a custom page template in a different folder? I'm setting up a little framework for WordPress that I can use over and over for themes and just for the sake of being tidy I want ...
0
votes
1answer
1k views

Creating a mobile site by adding a new class to the body tag from functions.php

Essentially is there a way to use a function in functions.php to turn the <body> tag into <body class="mobile">? I have code that recognizes mobile devices but right now it's set up to ...
0
votes
1answer
105 views

Automatically load Wordpress page on server every XX hours

I have a page in my Wordpress site that calculates post popularity and updates several meta fields on the posts and calls a few functions as well. This page is set to "Private" so that only myself and ...
2
votes
1answer
566 views

How to create Sub Sub domain Multi User blogs?

Hi to all I would like to create a big Wordpress network with this structure: sitename.com (Main website) cat1.sitename.com (sub website) cat11.cat1.sitename.com (sub-sub website) cat12.cat2....
0
votes
2answers
216 views

Disable category RSS Feeds on Wordpress blog with PHP

I have a Wordpress powered site and I would like to know how to disable all category based RSS feeds with PHP or even mod-rewrite if possible. Thanks
0
votes
1answer
598 views

How to use custom fields to replace top-level parent title with an image using wp_list_pages?

I'd like to integrate get_post_meta into the wp_list_pages mix so that any top-level parent list items get replaced with images ONLY when a key exists in the post's custom fields section. I can't do ...
0
votes
1answer
2k views

Wordpress plug-in for dynamic download link?

I am using Wordpress and I like to serve a page with a link to download. That link points to a new file EACH DAY. Is there a plugin that can do this? Store a list of filename per day Rotate each day ...
0
votes
1answer
477 views

Function to add DIV Class?

I'm building a WordPress options panel. In my options panel I added the following, this creates a Yes/No dropdown menu asking whether or not the user wants to display breacrumbs - I want to be able ...
0
votes
3answers
455 views

Using WP functions such as the_title() in an included php file

I'm including a php file in single.php, in the loop. Is it possible to use WP variables such as the_title(), the_date(), etc in the included php file?
2
votes
1answer
127 views

Wordpress and Custom PHP single SignOn

I have a Wordpress installation and some php pages (not related to Wordpress). I want to use the same login between Wordpress and My Php pages. When I login from my php, and go to wordpress, it ...
-1
votes
1answer
328 views

Alternative loop syntax error [closed]

I'm trying to minimize my code and have put together this little snippet, it doesn't seem to work however. What am I missing? query_posts( 'year=2011' ); if ( have_posts() ); while ( have_posts() ); ...
0
votes
2answers
3k views

Conditional Statement - check if post has an attachment image

I'm working on a conditional statement (in a loop) that looks for a featured image then grabs a default image if there is none, which I have figured out. But, I also wanted a way to pull the first ...
0
votes
3answers
6k views

wordpress wp_enqueue_script() not working

I'm trying to add this social-network button: <a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" data-type="compact" id="svejo-button">Add in Svejo</a> ...
0
votes
1answer
251 views

Can not call .php files after switching to %postname%

This $('#content').load("submenu.php"); works just fine with default permalinks When I switch to %postname% it does not work any more But, I can still go though to mysite.com/submenu.php and it ...
1
vote
2answers
402 views

WP_cron won't trigger my action

I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run ...
-1
votes
1answer
181 views

wordpress featured image

I'm new to Wordpress and I'm trying to create a new theme for it. I've downloaded the latest version (3.2.1) and installed it successfuly. But when I install my wordpress theme (to start to add the ...
0
votes
2answers
253 views

GET problem in WordPress

I have a strange problem. Any form using GET redirects back to the page not sending the variables. POST does work. I thought it might be an issue with the .htaccess but I deleted it and had WordPress ...
1
vote
1answer
2k views

How to sort posts based on the value (number) of a post's metadata?

I'm using the GD Star Rating plugin and the bbPress plugin. The first plugin do have a argument to sort posts by number of votes. But unfortunately, It doesn't work with WP_Query (and apparently the ...
0
votes
1answer
306 views

Add ASC / DESC to custom post columns

Im using the following code to create custom columns in the backend of the posts menu. add_filter('manage_edit-post_columns', 'post_edit_columns'); function post_edit_columns( $columns ) { ...
0
votes
2answers
415 views

Wordpress gallery shortag

I'm creating a simple slideshow on the side where i want to show 4 images from a post, i searched around i found this code that simply uses the build in gallery function <li><?php echo ...
0
votes
1answer
31 views

In Wordpress, how do you make several different editors for a single page?

I have a homepage that has many different parts to it. So a s single editor can get convoluted very quickly. Is there a way to break it up so that many editors attribute to this single page? If so, ...
0
votes
2answers
413 views

Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories

I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories (...
3
votes
1answer
417 views

Installing wp3.2.1 on IIS; getting empty sessions

i have to install wordpress 3.2.1 on IIS 5.0 (yeah, i know...) here. Brand new default wordpress installation, no plugins ore previous versions installed. So, i downloaded the 3.2.1.zip and the 3.2.1-...
0
votes
1answer
3k views

post content and shortcode content displaying out of order

I've seen a couple of questions that address this problem but I can't seem to get it to work based on the answers given. I have 2 plugins that I've written myself that output content via shortcodes. ...
5
votes
1answer
8k views

add_filter the_content str_replace after shortcode

I want to add a PHP str_replace to the add_filter('the_content') function. I believe my problem is that the shortcodes are loading after the str_replace is called. I have a shortcode that outputs a ...
0
votes
2answers
554 views

Insert content into <title> head tag with function

Is there a hook available that lets you append or prepend text to the <title> tag in the head? I've seen lots of posts about customizing the <title> tag, but they all involve manually ...
0
votes
1answer
26 views

Limit 'contributers' abilities in WordPress

I have a few custom post types which i don't want any contribute to view or touch. However, the default settings allows contributes to see these in their admin. How do i disallow contributes access to ...
1
vote
1answer
2k views

Is there a Wordpress version that is incompatible with PHP 5.3?

Is there some decent information available which WordPress versions do not support PHP 5.3? I mean the more recent ones like 2.9 / 3.0 / 3.1? I'm only concerned about the Wordpress core codebase, not ...