Articles of php

help with custom shortcode that stopped working

A while back I wrote a shortcode for my site, and it just recently stopped working. I’m wondering if someone can help. The shortcode is called paramtext. What it does is check the value of a certain parameter in the page url, and if it meets the criteria, wordpress displays whatever is within the shortcode. […]

How to write to a separate PHP file in plugin settings

I need a way of taking a variable from a plugin’s settings and write it to a small key file located in the plugin’s directory. The entire contents of the key file is this: <?php $transaction_key = “npo7d3A0d2hhTYF5w9uo”; ?> I’ve tried to use file_put_contents, but I can’t get it to work. Anyone know how to […]

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 […]