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

Make separate text boxes for separate WordPress Custom Fields

I am trying to make usability of WordPress custom fields admin easier in my theme. I saw it in ElegantThemes' eStore theme. Only I couldn't figure out how to do it in my custom theme because I couldn'...
0
votes
1answer
70 views

Getting a WordPress tag to print inside of a traditional php echo

I want to get the template path to print in this echo of a form in the admin. Here is what I got: < ?php echo of_get_option('splash_img_transition', 'bloginfo('template_url')+/images/large/...
3
votes
4answers
16k views

Get custom post type by category in a page template

I've created a custom post type with categories and sub categories, what I need to do is list out the post titles and images for a given sub-category or category in a page template. I've got as far ...
1
vote
1answer
150 views

Wordpress: Access a plugin from within a theme

I am creating my own custom wordpress theme, this in general is not the problem. I would like to use a plugin that is normally used within pages/posts. (NextGen Gallery, to make a sort of slide show ...
0
votes
1answer
178 views

Call Current Category

I'm using this in a file named category-portfolio.php which is for the archives page of my portfolio. I don't want to use cat= to specify a specific category. But when I don't use cat= it pulls up ...
0
votes
3answers
251 views

A better code for no post format?

As suggested on this site, I am using this code to style an excerpt if no post format is selected/if it is a standard post. <?php $format = get_post_format(); if ( false === $format ) { echo 'This ...
4
votes
1answer
3k views

Add extra field to users

I have this code that adds the check box to the 'Edit User' page but when i check it, and refresh the page, the box becomes unchecked... what is wrong? add_action( 'show_user_profile', '...
0
votes
3answers
4k views

Create post from form with image

I found this wonderdul script that @Bainternet here at Wordpress Answers created, that makes it possible to attach images into posts from a html form.. I tried to combine in into my "html form to ...
1
vote
1answer
101 views

How do the pros code up a WordPress theme? Locally? Through FTP?

Up until now, I've been building my WordPress sites by transferring files through FTP. This can sometimes get really slow (time it takes to upload the file, Firebug slows to a crawl, etc.) and I was ...
7
votes
4answers
9k views

How to Remove all Instances of edit_post_link

Can someone please assist with how to remove from my theme, whilst in author mode, the edit_post_link (Edit link), throughout all my pages. Which php files in the Twenty Eleven theme (WordPress v3.2) ...
-1
votes
3answers
2k views

PHP code for link with text

I was exploring and ran across this post: https://wordpress.stackexchange.com/questions/22423/grab-first-link-from-a-post-grab-first-blockquote I would basically like to do the same thing, but have ...
0
votes
3answers
6k views

Category.php template for custom posts

I'm trying to use my category.php file to display all posts of a certain custom post type (say "Company") with a given category. However, when I try to use it by navigating to domain.com/category/...
0
votes
1answer
2k views

Show the categories the current post has

I have a custom post type; posts of this type can have either one or two categories associated with them. I need to display the names of the categories that are associated with each of these custom ...
0
votes
1answer
122 views

Page permalink rewrite

I added the following code which allows categories on my 'Page' post type. add_action('init', 'edit_page_type'); function edit_page_type() { register_taxonomy_for_object_type('category', 'page');...
3
votes
2answers
4k views

How do I remove a require_once admin panel from the parent theme from the child theme functions.php?

In the parent theme, the following is at the bottom of the functions.php file. require_once(TEMPLATEPATH . '/admin/admin-menu.php'); In the child theme's function.php, this code will include the ...
0
votes
2answers
5k views

PHP echo inside javascript

I've got jwplayer installed in wordpress and have it showing in a single.php page... the way I have it I need to get a custom field in the javascript and I;m having no luck echoing it in there. I know ...
0
votes
1answer
172 views

single.php error

writingyourwaytosuccess.com/blog Attempting to view a single post returns the following error: Fatal error: Call to undefined function atmosphere_posted_on() in /home/content/46/7460046/html/wp-...
0
votes
4answers
882 views

Get Page ID from Backend

How can i get a page ID from the Admin backend? I'm saving data into a metabox on a 'Page' post type, and I need to return that data on the page in another area. But $post->ID obviously dose not work.....
1
vote
1answer
802 views

Importing Geo data into wordpress database

I have a listing wordpress site and want to integrate geo data into the Wordpress MySQL Database for custom search functionality I want to utilize different aspects to create different things... ...
1
vote
1answer
2k views

Colorbox ajax loading of outside HTML content works perfect on localhost but not on server

I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it ...
0
votes
1answer
2k views

Help with Wordpress function inside a shortcode

I'm trying to spice up a theme of mine with some shortcode buttons but I'm having quite a bit of trouble when trying to call the author's name within the button itself. I tried simply including <?...
1
vote
2answers
190 views

sidebar isn't showing, what's wrong w/ this code?

Here's what I have in my sidebar.php: <aside id="sidebar"> <?php if ( is_user_logged_in() ) { echo '<a href="/community"><img id="visit-the-forums" src="'. bloginfo('...
13
votes
4answers
40k views

Setting custom cookies in Wordpress

I am trying to set cookies to re-route returning users to my a specific page within my Wordpress site. I'd like some advice with these 2 things: Where in the Wordpress php files should cookies be ...
-1
votes
2answers
4k views

How to strip/remove all blank spaces at the beginning/end of a search string

I use hack of Chris_O for highlighting the search terms. When a user enters the search keywords without any blank space in the beginning or at end of the search string it retrieves and highlights the ...
2
votes
1answer
1k views

Wordpress custom image size on custom field image

Hi can anyone tell me a good way to use a custom image size with a custom field image in a template without using something like timthumb/phpthumb. I've set an image size with... add_action( '...
11
votes
5answers
6k views

Wordpress and magic quotes

I've been writing some Wordpress plugins, and I've been having some problem with Wordpress putting magic quotes on POST and GET data. Specifically, the "wp_magic_quotes" function in \wp-includes\load....
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
476 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
99 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
677 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
877 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
120 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
891 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
677 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
314 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 ...