Articles of php

Wp Debug Enabled True Notices and Warning

Notice: Undefined index: Zumpito_event_full_day in /home2/michael/public_html/ on line 246 Warning: Cannot modify header information – headers already sent by (output started at /home2/michael/public_html/ in/home2/michael/public_html/ on line 197 Warning: Cannot modify header information – headers already sent by (output started at /home2/michael/public_html/ in/home2/michael/public_html/ on line 1228 The Code on Line#246 is this – $arr[‘Zumpito_event_full_day’] = ( […]

Can I remove or edit an include() from a function with a filter?

I need to edit the output of a plugin and the part I need to change is actually a html file that is brought in using include(name-of-file.html). The function has a filter, but I am just now beginning to understand how filters work, and cannot seem to figure out how to change that path. Basically, […]

Reusable code that I can store in the function.php and apply to other templates as need. Dry Code

I am trying to apply reusable code to some single-posttype template and I was wonder if I can store the code somehow in the function.php and include it where i want to. Here is the code if (!empty( get_field(‘social_title’) )): $socialTitle = get_field(‘social_title’); $socialContent = get_field(‘social_content’); $link = get_field(‘social_link’); $cleanString = strip_tags($socialContent); $cleanTitle = strip_tags($socialTitle); […]

How to edit the styles for the table of pages/post listed in the admin when you click on pages/posts?

It seems that some of the css on the table that shows the list of all the pages adversely reacts with one of my plugins, which adds a bunch of columns to the table. I’m pretty sure this is edit.php. At least, that’s what’s in the URL. Using the developer tools in Chrome I noticed […]

Live search from database table

I have wordpress site. I made custom table and sotred values in one row. Now I made admin menu and added input field into it. <input id=”location1″ type=”text” /> I need to predict search while I type. So if I have stored word “computer” and “company” and I start typing comp, under search box results […]

Querying for specific tags

I currently have this code that pulls all of the tags and creates a list with links for them: <?php $tags_array = get_tags(); foreach( $tags_array as $tag) : $tag_link = get_tag_link( $tag->term_id ); ?> <li> <a href=”<?php echo $tag_link; ?>”><?php echo $tag->name; ?></a> </li> <?php endforeach; ?> I need to pull only specific tags by […]

Using wordpress function to retrieve data

I have been working on open source plugin and trying to add a new feature to it. For now I have been doing like this else if( $selected_report == “greport” ) { $sql = mysql_query( “SELECT rating_postid FROM {$wpdb->ratings}” ) or die( mysql_error() ); } generate_csv( $sql ); exit; function generate_csv( $sql ) { header( […]

Initial offset of number of posts in home page on the posts page

I’ve got a problem. Im using WP_query on my static home page, and i’ve set up an ‘archive’ page (not like archives/tags etc) as my ‘page 2’ which has all my other posts on it. My home page is a total of 13 posts, but I was wondering, on the ‘archive’ page, how do you […]

Azure WordPress site – URLs not showing on move from root to subdirectory

Moved the site from the Root to a Sub-directory by following these instructions Changed the WordPress site URL and Site URL (the same in this case) Created sub-directory Edited the index.php Copied the all files to the sub-directory (except web.config) Moved the “web.config” file to the sub-directory Checked the permalinks I am able to […]

Change MySQL PDO connection to a WPDB connection

I have an autofill search box with a PHP script that gets data from the DB. It uses a PDO connection, and it works perfectly even with my WordPress Database, but since I’m not sure of how PDO works, I’d like to rewrite this with WordPress functions. Does anyone know how? This is the autosuggest […]