The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
6
votes
1answer
5k views

Add a class to links in the visual editor (how to get old dialog back)

New: Old: In short, i want a list of some classes inside the add link dialog. Because this was default there might be a easy way to get it back like this? Long: I like to have the ability to add ...
0
votes
2answers
118 views

Editing a PHP file to include a small text piece on every page

I'm building site (dummy site is up at www.teamcoding.ca/corporate) and would like to include in the upper-right hand part of the screen, "Switch to Lifestyle Site" with a link to a different site. ...
0
votes
2answers
1k views

Get current Wordpress page then add #post ID to the end

I'm trying to find out the PHP code that will get the current URL and add a hash ID onto the end of it so a link can be generated and linked to. The end goal is to create a link that returns: http://...
2
votes
2answers
843 views

How to execute a simple php script in WP (I don't think wp_enque_script applies here)

I have a wordpress page where I want to include a budget calculation tool. This budget calculation tool is of course tied to a php script that executes the fields in the budget calculation tool. This ...
0
votes
3answers
146 views

Wordpress redirect on login

I have downloaded my site to a production environment. I have set up both the live site and the production site to use the same DB. When i login to the admin panel i get redirected to the live site. I ...
2
votes
2answers
424 views

Create new category upon save based on post information

After finding a couple of leads on how to do this, I'm coming up blank. What I am trying to accomplish is to add the post to a new category based on camera name. If the category doesn't exist, then to ...
0
votes
1answer
93 views

Wordpress Plugin Receive a Link

I'm writing a Wordpress plugin. The plugin should allow every user to rate posts (1 to 5 stars). What actually works is to read the rating from storage and show the stars. So there are five <a> ...
0
votes
1answer
2k views

Get categories names as an array to use it in theme settings

I am building a theme and for the Theme Settings Page I followed this tutorial: http://wp.tutsplus.com/tutorials/using-the-settings-api-part-1-create-a-theme-options-page/ What I want now is to have ...
0
votes
2answers
646 views

Manually Remove and Change WordPress Page/Post Title

I have added custom metaboxes into the wp-admin page and post editors. There is a metabox with the ability to enter in a person's first name (ex. "John") and last name (ex. "Doe"). I want to set ...
1
vote
2answers
322 views

On this day PHP code

I'm working with this code snippet for an "on this day" type post. However it is only showing 1 year in the past. I'm looking to automate this so it shows on this day in 2009, 2010, 2011... and as the ...
1
vote
1answer
2k views

Mass update excerpt

I'm using a photoblog theme which upon creating a new post it takes the post attachment and saves a modified "img src" string into the excerpt field. It then uses <?php the_excerpt(); ?> to ...
0
votes
1answer
781 views

How to display results from a data table with an encrypted user id?

I'm trying to display a table of results for particular users who have submitted answers to quizzes. The problem is that the mysql database I am working with has a funky value for the user's ID. I'm ...
0
votes
1answer
543 views

Good RSS Feed Parser to use on php file?

Was trying to use EmbedRSS Plugin but the php code that I used to put it into my index.php file doesn't work. [cetsEmbedRSS id='http://deannaschneider.wordpress.com' itemcount='2' itemauthor='1' ...
2
votes
1answer
75 views

automated tests as a user?

I checked out (with svn) the code for Automated Testing. However, I want to run unit tests as a specific user. Is there a way to do that? That is, is there a way to loggin with php code alone?
0
votes
2answers
883 views

Should i use the wordpress Options table or to create database table..?

I have an application built in asp.net but i'd like to port it over to wordpress as a plugin. Is it practical to develop the php version of this app using the Wordpress options table or should i ...
0
votes
1answer
2k views

Adding a unique class to wp_nav_menu

How would I go about adding a unique class to the direct child li elements of the main parent ul element generated with wp_nav_menu? <nav id="access" role="navigation"> <div class="menu-...
1
vote
2answers
1k views

wordpress JSONAPI introspector always limits number at 10?

I'm a little new to Wordpress and the JSON API so forgive me if this is a newbie question but i'm trying to get all of the posts of a few different custom post types and return them as JSON via my own ...
0
votes
1answer
127 views

Getting a WordPress Debug Strategy

I have been reading up on debugging. I watched Chip Bennett's video on wordpress.tv and was inspired to take debugging seriously. What I have found in my reading up though has confused me a bit. I ...
0
votes
1answer
78 views

How can I add more code to this?

<?php $my_query = new WP_Query( "cat=11&posts_per_page=1" ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); ...
0
votes
1answer
921 views

Why can't I call a (member) function from within a foreach?

I'm working with a plugin called media tags... The foreach looks as following (simplied as much as possible) foreach($mediatags as $mediatag){ $args = 'media_tags=animals&numberposts=10&...
0
votes
2answers
244 views

variable value disappears in a second loop

i can't manage to "see" the value of $originalArticle in echo '/'.$originalArticle.'== &'.$sameArticle; : i tried with "global" before, but it does not work... The output is for example : /== &...
0
votes
1answer
79 views

Client cant see the Updated dynamic content

I have came across an issue... whenever I upload new content to the site.. and i send the link to the client.. He can not view the changes instead what he see is the previously updated content. Looks ...
0
votes
2answers
3k views

I want to remove the links from the term list returned by get_the_term_list

I want to keep this category title on my pages, but I don't want it to be a link. <?php echo get_the_term_list( get_the_ID(), 'portfolio_cats', ' ', ' , ', ' '); ?> Can anyone help? Thanks
3
votes
1answer
19k views

How do I get the author's page url from their ID?

What is the best way to get the author's page url, so http://example.com/author/user73, from their ID number?
0
votes
1answer
621 views

How to add custom function to pluggable.php

I am working on a WP plugin and I want to add a custom function to pluggable.php (located in /wp-includes). I am calling that function from admin.php (located in /wp-admin) eg. Consider the function ...
9
votes
1answer
3k views

dbDelta support for FOREIGN KEY

On PHP 5.3.13/MySQL 5.5.21 the following code doesn't work: if($check_custom_fields_form!=1){ $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." ( `form_name` ...
0
votes
1answer
2k views

Most viewed posts in Wordpress

I am owner of a blog/website and I am using this code for tracking post views in site : function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $...
0
votes
1answer
833 views

Force Users To Relogin

I need a solution that i can use to force a user to logout via the admin panel of word press any help on this would be appreciated.
2
votes
1answer
3k views

the_author_meta not working

I'm trying to use the_author_meta to retrieve some links which users can set in their profile. I set up extra profile fields and they are saving to the database. On my author.php I have the ...
4
votes
3answers
3k views

How do I override the Message-ID header of wp_mail function?

I have a custom notification function for our comments editor, who prefers to have all comments from one article threaded together in her email client. To achieve this, I'm creating a custom message-...
20
votes
5answers
23k views

the_date() not working

I am using wordpress 3.2 and I did a query post like this: <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?> Then I try to echo out the date of this post I queried like ...
0
votes
2answers
248 views

unknown issue in 'header.php' preventing theme from displaying fully

My theme is currently activated and showing only the background image and the "home" link. I believe the issue lies within header.php, but I can't quite figure out what. Any ideas? (Also, is there a ...
0
votes
2answers
2k views

Where is wp() function definition?

In WordPress source code, there is one point I can not understand. In /wp-blog-header.php, there is a call to wp() function. However, I can not find any definition for that function. How this call don'...
0
votes
2answers
4k views

Hide a div to subscribers(user role) in one page (is_page)

Hello have been looking at this for quite a while and cant seem to resolve it was hoping someone more familiar with the wordpress core and php could share some idea. What I want to accomplish ...
1
vote
1answer
680 views

Setting up widgets in wordpress with a unique ID for the after_title argument

I try to get the collapsible-widget-area plugin so that every widget it creates inside the collapsible area has a unique id <div> after its title. function get_args() { $this->args = ...
0
votes
2answers
662 views

Using the_excerpt() on a page

I've been trying to utilize the PHP excerpt function to call from her recent blog post to post on a main landing page without avail. Any thoughts? <div id="home_news" class="prefix_9 grid_3"> ...
0
votes
1answer
74 views

How to extend the page editor?

I'm really a newbie to WordPress. I can edit the page via admin Page menu. There is a form submitted on that page. How can I write my own functions to handle this form submission? In other words, how ...
0
votes
1answer
118 views

Vote It Up Plugin - Add ascending numbers to MostVotedAllTime Chart Function

The following function shows a top 10 chart of most voted posts. How would I add acceding numbers to this chart eg 1 - example Post1 2 - example Post2 etc function MostVotedAllTime_Widget() { $...
1
vote
1answer
1k views

Accessing WPDB Multidimensional JSON Array w/ Javascript

I am having trouble accessing json values return from an ajax call. Here is the call: $.ajax({ type: 'POST', data: 'user_id=' + user.user_id + '&user_login='+ user.user_login, //...
1
vote
1answer
85 views

How do you remove plugin edit option?

I would like to remove the edit option for all plugins on a wordpress site. Is there a hook/filter for doing this? It would be preferred to do it from the theme's functions file, rather than try to ...
0
votes
1answer
216 views

Creating a WordPress shortcode

I'm coding my first WP shortcode and am having trouble turning my working PHP into a working shortcode. I have successfully created a basic shortcode that returns text in the spot I'd like so that ...
0
votes
2answers
261 views

Dynamically generating an '<a name=“”>' reference with PHP

I'm trying to dynamically generate a <a name=""> link reference inside of a Wordpress plugin. The plugin will output this link reference inside of the posts it generates. The categories of ...
1
vote
1answer
173 views

How to create a custom category of wordpress admin

i was wondering how I would create a custom tab and page for wordpress admin screen, and save its data. I want a ticker on my main page, and the <li> data would change whenever I have new ...
2
votes
2answers
6k views

Hiding a php element from mobile browsers

I've stuck a static width content slider on my Wordpress sites front page. I'm using the Twenty Eleven theme with a small piece of code included into index.php to display the slider. Unfortunately ...
0
votes
1answer
603 views

Post ID wrong in Functions.php

I am trying to execute the following code inside my functions.php to change the title of my wordpress blog. function filter_pagetitle($url) { global $wp_query; $the_post_id = $...
0
votes
2answers
10k views

Download images from media library to computer in BULK?

All I want is to download all images from the media library to my computer. I don't want to then use them in another site. I uploaded them from a camera card while traveling, and then it was stolen. ...
0
votes
1answer
60 views

Is there a (offical) way for a theme to deactivate itself and show a message in admin?

I know that plugins can deactivate itself, but how about themes? I work on a parent theme (Framework) and I don't want users to be able to activate it. This is what I have so far. The problem is ...
0
votes
2answers
3k views

Show different size featured images (the_post_thumbnail) for 1st, 2nd and 3rd posts?

I file all the galleries on my blog under the 'gallery' tag. I use the following code (via) to display the latest 7 gallery posts after the 8th latest post on home page: <!-- Featured post ...
4
votes
1answer
166 views

Getting the action's tag name within the action

There's a function attached to a set of actions, like this: add_action('some_tag', 'the_function'); function the_function($maybe_some_vars){ // ... } Is it possible to find out the action name ("...
1
vote
1answer
82 views

Is it better to create a function or a variable for current_theme_supports?

Well I just asking myself this, there are two ways I could implement this. What would be a better fit to coding standards? Or is this just a a matter of personal like? And what about php and memory, ...