Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
58 views

Help Combine These Two PHP Codes

I have my WordPress post format codes: <?php if ( has_post_format( 'image' )) { echo 'This is a image post'; } ?> And my code to grab the first image from a post... <a href="<?php ...
1
vote
1answer
4k views

How do I hardcode a WordPress shortcode into my theme?

I am using WooTheme's Canvas theme and would like to "hardcode" in the [post_comments] shortcode into my theme. [post_comments] displays a comment link with comment count (ie Comments 10) in my post. ...
0
votes
2answers
468 views

If Statement Post Formats: No post format selected

I'm working with post formats, most of my code looks similar to this: if ( has_post_format( 'standard' )) { echo '<?php get_sidebar(); ?>'; } if ( has_post_format( 'aside' )) { echo 'this ...
1
vote
3answers
300 views

How to create post thumbnail

I am working on the WordPress Twenty Ten theme, and I want to display post thumbnails. I have followed the steps below: Added following code in functions.php file: if ( function_exists( '...
1
vote
2answers
3k views

Wordpress WP_Query() Not working properly

We would like to know that how we occur error when we implement this code in our sidebar.php $categories = get_categories(); foreach($categories as $category) { printf('<h2>%s</h2>&...
-1
votes
2answers
5k views

Wordpress WP_Query() Not working properly

I would like to know why we get an error when we implement this code in our sidebar.php: $categories = get_categories(); foreach($categories as $category) { printf('<h2>%s</h2><ul&...
1
vote
1answer
536 views

Displaying NextGen Gallery using value from meta not working

When a user creates a new post there is a meta field on the back end where they can enter the id of the nextgen gallery to display. I want to then display in their post the gallery which corresponds ...
2
votes
1answer
4k views

tag search using WP_Query

I need to find only posts with a tag forest gump. I've tried: new WP_Query('tag=forest+gump');, new WP_Query('tag=forest gump');. However they both return ALL the posts and not only the posts with ...
0
votes
2answers
156 views

Alter required message using comment form api

I prefer not to use asterisk markers on required fields in the comment form. So I'd like to remove or alter the 'required fields are marked (*)' message. Being a good wordpress user, I'd like to do ...
2
votes
1answer
2k views

Getting the dropdown menu to redirect to different pages?

What I am having trouble with is a dropdown box that I want to add to my sidebar. the blog will have more than one user so what I want for the dropdown to do is list all the different users by their ...
1
vote
2answers
95 views

New to wordpress, Question about editing PHP

Ok, I am pretty new to wordpress, and I have been reading a lot of the documentation online and testing things out on my own blog. I have just run into a couple of general questions. At first glance ...
1
vote
2answers
663 views

Wordpress - how to replace <!--more--> with string on the_content() in single.php

I want to add text on a single wordpress blog post page where the "read more" text would usually be inserted. However, I can't configure a plugin to replace that text. I tried a few different ...
0
votes
1answer
384 views

Function to call either single post or category

I'm trying to display content depending on if a user is in a category or a single post. The function i'm using if this is a category is: <?php if (is_category('')) { ?> Similarly the function ...
1
vote
1answer
875 views

wordpress the_post_thumbnail() not cropping properly

I am using the wordpress function the_post_thumbnail(); but it seems to behave differently in different places. I have the following code on one page: the_post_thumbnail(array('275', '190')); Does ...
1
vote
3answers
1k views

Make first letter of my taxonomy uppercase

I'm using echo get_the_term_list( $post->ID, 'trpropcity', '', ' ', '' ); to show a taxonomy link, I'd like to make this instance of it only have the first letter capitalized, Cleveland not ...
0
votes
2answers
72 views

Wordpress Theme Modification Help

I'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on ...
0
votes
1answer
180 views

Add Column to Term Database

Currently the Term Database has four columns. term_id name slug term_group. I would like to add another column called menu_order. How can i do this? The outcome i want is to be able to order my ...
0
votes
1answer
119 views

How can I restrict access to a widget to admins only?

I have a very basic text widget, all it does is link to a PHP script which displays a random banner image. I would like to restrict viewing access to admins whilst I'm testing the widget. How is this ...
0
votes
1answer
2k views

Wpdb->insert() doesn't insert new row after the last one

In JavaScript, I'm using an Ajax call and I'm sending an array of shops. Except for the last element in the array all the shops already exist in the DB. The last element is a new shop. The PHP code ...
1
vote
1answer
853 views

Taxonomy filter all children

I have a custom taxonomy filter that will filter all the pages in the selected taxonomy. I would like the code to select the pages in that taxonomy, and the children of thous pages. Heres the code. ...
1
vote
1answer
2k views

Add title, post content, and category like add_post_meta and update_post_meta

How can I update/add a new title, post content, and category to a post with hard PHP code similar to add_post_meta(), update_post_meta()?
0
votes
2answers
673 views

WordPress plugin admin page - using WordPress function in linked php file

Asked this question on StackOverflow and they directed me over yonder... nice place ya got here =) I've been developing a pretty simple WordPress plugin, and wanted to do some live validation of ...
1
vote
1answer
137 views

how to add three default images to wordpress?

how to add three default images to wordpress custom background? now, i want to add three default images which can be selected one by the user.and it locates on the upload Image part.like this: the ...
0
votes
1answer
312 views

How do I choose not to display the title header on a specific page?

I would like to have one specific page on my WordPress blog omit the header . Is there a way to wrap that title code from page.php in my WordPress theme in an if clause that specifies the page I do ...
5
votes
3answers
24k views

Query menu_order custom post types

I added 'supports' => 'page-attributes' to my custom post type, and now i have the meta box for page ordering. When i use the argument 'sort_column' => 'menu_order' with get_pages() on my ...
0
votes
4answers
567 views

Value prints outside of the echo

My code validates and returns the custom field value. However, I can't get the value to return inside of the anchors. Here is the code: <div id="meta_mblink"> <? if(function_exists('...
2
votes
1answer
2k views

Adding featured image via PHP

Currently I'm working on a project where site is driven by user articles, how it works: Any user goes to compose post page and writes post along with few details, has upload file option for image and ...
3
votes
2answers
413 views

Getting the comment number relative to all the post's comments

Any ideas how to accomplish this? Something like this would work, but if there are threaded comments you get the wrong number, because pages with threaded comments have actually more comments than ...
2
votes
3answers
5k views

wordpress inserting posts programatically through a url

I have to insert posts programatically in Wordpress. I want that I should be able to publish posts via a url. Something like www.mypage.com/insertnewpost.php?title=blah&content=blahblahblah&...
1
vote
1answer
185 views

Wordpress plugin/code to hide all things related of a user from the public

I am looking for a plugin or a code that will allow admin to hide all things related to a specific user. Not to delete it, just to hide it from the public. Something like to be unable to viewed from ...
2
votes
1answer
6k views

Function to show random posts from a category

Hi to all I'm trying to create a function that can ECHO the excerpt of a random post from a choosen category. What I did up to now is: <?php function $titoloslide() = { query_posts(array('orderby'...
1
vote
1answer
765 views

Wordpress shop: enable custormers to select product color using image thumbnails on Custom Fields

I use Wordpress Custom Fields to provide customers with various product color codes in a drop-down list, but now I would like to add the various color thumbnails for ease of selection...similar to how ...
1
vote
2answers
301 views

Can WordPress email the admin about PHP errors, while hiding them from the site?

Is it possible to have WordPress email the site administrator whenever a PHP error message is displayed? Ideally the message would also be filtered out of the HTML output, so as to avoid information ...
0
votes
2answers
1k views

RTL Stylesheet Confusion with WordPress

All I understand about RTL is that some languages are written right-to-left. In a WordPress theme, what role does the rtl.css stylesheet have? I was under the impression that the only difference was ...
15
votes
1answer
11k views

Contact form redirecting to page not found on send

I have a contact form that I used lot's of times before on other non WP sites but it doesn't seem to work on my current WP site, it just redirects you to a page not found. I don't want to use any ...
2
votes
1answer
7k views

How do I create a drop down menu in a widget?

How do I create a simple dropdown menu with 3 options in a widget? I'm using $instance to do it. How would it look in a barebones widget?
0
votes
1answer
1k views

HTML table attributes ignored

I'm trying to add a table to a php page template. The headers and cells contents show well, but the table attributes are being ignored. This code: <table border="1" cellspacing="10"> <tr&...
1
vote
2answers
2k views

APC 500 Internal server error [closed]

I have a blog running on a FreeBSD 8.1 system with PHP 5.3.5 and APC 3.1.6. At first everything seemes fine, but after a while (about 18-24 hours) all pages are served blank, and with a status code ...
2
votes
2answers
2k views

Have Plugin Handle Specific URLs

Does Wordpress have the ability to use the currently defined template to serve up content in the database? For example, I have a database of a bunch of custom content-- the name of an item, the price,...
1
vote
1answer
908 views

Custom excerpt function re-factoring

This may be more of a php best practices question, but here goes... I am using a custom excerpt trim function: function new_wp_trim_excerpt($text) { // Fakes an excerpt if needed global $post; ...
0
votes
2answers
77 views

search and add in wordpress content

I have a wordpress plugin that displays videos through a shortcode. My problem is it assigns the div's with ID's such as video-1-player, video-2-player, etc. I need to create a function that searches ...
0
votes
1answer
43 views

Cannot Access Console

http://bigpicturepartnering.com I can log into the site. When I try to access the WP console I get the following error: PHP Fatal error: Call to undefined function is_site_admin() in D:\websites\...
0
votes
1answer
371 views

File Upload with Server in safe_mode

When I try to upload an image to a post, I get an error: "The uploaded file could not be moved to /home/httpd/xxxx/xxxx/xxx/wp/wp-content/uploads." My server is set up in safe_mode - is that the ...
0
votes
1answer
294 views

What's the best way to include PHP code in pages?

I'm currently creating a bunch of (empty) pages and performing conditionals such as is_page('Blabla') on it, which increases my page.php significantly. I'm already using require_once for different ...
0
votes
3answers
2k views

I want Page titles and excerpts to show up on home.php in certain order

In the functions.php, I have the following code added: add_post_type_support( 'page', 'excerpt' ); This allows pages to have excerpts. The reason I want an excerpt is because I want to call only ...
0
votes
1answer
174 views

Wordpress permalink issue

If i try to access my wordpress page using the native url structure i.e. for instance: www.mywebsite.com/?p=123 I am redirected to my homepage. It doesn't seem to be an htaccess issue for I tried ...
0
votes
1answer
82 views

Any way to hide a blog posts text if it's longer than let's say 300 characters

Is there a way of hiding a blog posts text if it's longer than let's say 300 characters. I don't want it to push the rest of the content below the fold. You know, the show more text thing.
0
votes
1answer
67 views

WP plugin updates [duplicate]

Possible Duplicate: WP plugin updates I wrote a plugin for WordPress which requires regular updates. Is it possible to notify user of new version being available (some of the other plugins have ...
3
votes
2answers
4k views

problem with ajax and the path to the php page

i would like to call a php page from an Ajax method : the alert works fine, the code as well has been tested outside of wordpress, but here it seems that the php page is never called. I found some ...
2
votes
1answer
1k views

Using WPAlchemy metabox values in another metabox

I'm building a quite complex custom post type structure and I would need some help regarding my metaboxes. What I want to do: Thank's to the have_fields_and_multi() function, the user enters data in ...