Articles of php

Template code to split a post and print a custom field?

So I want a blog post but in the center of every blog post I want to split the content and print a custom field attached to the blog post type. Ie you field called “Blog Quote” and the user will enter “Some sample text here.” Then put the body of the post in the […]

How do I pull information from one wordpress backend into another?

I am not even sure this is possible, but here is what I have in my head. I have 3 installations of wordpress. They each run affiliate WP. I have a main management site where my affiliates log in and have access to a bunch of banks of training videos and documents and such to […]

Allow user to Upload image and manipulate it on the frontend

The site I am working on allows users to post things up for sale. In the form for creating their post, there is a simple file upload field. The problem is that sometimes when users upload images they end up rotated and they have no way of choosing. I have put together a php script […]

Gravity Forms merge tags in templates?

Is there a way to put Gravity Forms merge tags in template.php files or other sections of the website? A plugin maybe? I need to retrieve a field value from one of my Gravity Forms and use it in the post that is created with the form. I’m having a hard time figuring out how […]

Writing PHP code in pages without issue?

I’ve currently been using a plugin called Insert PHP that’s just laughably bad and the cause of a lot of headaches. I have a lot of PHP code running in different Pages on my installation, so I was wondering if there’s a way to include the .php files and write in a normal text editor?

Storing content into a custom taxonomy

Currently I have created a custom taxonomy with the name “genre” and I am wondering how I can include it into the array for posting with the content from the string provided in the example. $my_post = array( ‘post_title’ => wp_strip_all_tags( trim( $post_title ) ), ‘post_content’ => $my_post, ‘post_status’ => ‘publish’, ‘post_author’ => 2, ‘post_category’ […]

How to style injected code in header section?

Trying to add custom code to header section <head>..</head>of the blog by adding this code to child-theme functions.php // Add scripts to wp_head() function child_theme_head_script() { if ( is_singular( ‘article’ ) ) { $cjt = ”.'<meta name=”date” content=”‘ . get_the_date().'” />’ . ”; $ct = ”.'<meta name=”title” content=”‘ . get_the_title().'” />’ . ”; } echo […]

Limit tags shown in post

How do I limit the number of tags shown using the code below, without having to add $count=0; or if ($count <= to the query, but only for the home page, and a different number for each set of post? <?php the_tags(”,”,”);?> I don’t want to add the count option because my post loop is […]

Image rotation issue (horizontal picture uploading as vertical) — Exif issue?

I am building a classifieds site on WordPress where users can upload their ads/images from front-end. However, when horizontal pictures are uploaded, they upload as vertical. I looked into the issue and found the following suggested solution for fixing image orientation using its Exif data: //read EXIF header from uploaded file $exif = exif_read_data($_FILES[‘ImageFile’][‘tmp_name’]); //fix […]

$wpdb->get_results breaking page?

I’m trying to generate a list of years that have posts on a WordPress page using a “php in posts” plugin that has a shortcode. but the code I’m using seems to break the page. What could be the issue here? [insert_php] $years = $wpdb->get_results( “SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type = ‘results’ […]