Articles of php

Function Display article

I am new in WordPress … I developed a theme and I want to display the contents of a specific item ID in a div. For example…I create this div. <div id=”myarticle”> //function php WORDPRESS </div> What is the php function that helps me to display the content of an article? Thanks in advance!

How to use `wp_insert_post()` and `get_permalink()` functions?

I’d like my script to post an article to WordPress site automatically. Looks like WordPress’s wp_insert_post() function is what I need. But if I would include wp-includes/post.php file into my script the function add_action() (placed in wp-includes/plugin.php) will be needed. The same story to get_permalink() function. So I will probably need to include more and […]

TCPDF get_post_meta outside the loop

I want to be able to export a html page to PDF. I downloaded TCPDF (mainly because it allows me save High resolution images and shrinks the filesize.) The TCPDF folder is in my theme folder. If a user clicks on a link in a certain page the current page should be saved as a […]

Different column width in 2 rows with bootstrap and custom post types-different classes needed

I’m using a custom post type on my WP website and also using bootstrap. I want to list 5 custom post type entries on my home page, and I want the first 3 to have class col-md-4 in one row and in the next row 2 cpt entries to have the class col-md-6 At the […]

Image Attachments of an Array into Flexslider

I’m using a third party wordpress plugin to incorporate realty listings into a website I’m making and I’ve set off trying to style the site to my needs. One of the problems I’m trying to solve is changing the slider options for an individual property page. What I would like to do is use Flexslider. […]

How to replace URL protocol using PHP?

I’m using HTTPS everywhere in my website but I have problems with sharing buttons for Pinterest and Tumblr. For example, when I try to share image on Pinterest I get this error: “Sorry we could not fetch the image.” To make it work, I think I need to change image source URL protocols to HTTP […]

Must filter functions receive all arguments passed to them?

I’m writing a filter function to redirect logins: function my_filter_func( $redirect_to, $requested_redirect_to, $user) { // My code. } add_filter( ‘login_redirect’, ‘my_filter_func’, 10, 3 ); The filter hook in the template file is: $redirect_to = apply_filters( ‘login_redirect’, $redirect_to, $requested_redirect_to, $user ); As you can see, $redirect_to, $requested_redirect_to, $user are passed to my filter function. My filter […]

how to enqueque code in a php file from functions.php

Im building a website with wordpress, using a child theme. there is a file in the main theme folders, called entry.php that is where I need to add a bit of php at the bottom of this document. I don’t want to touch the parent theme files, to avoid problems when I update the theme. […]

How to extract information from a wp_query result?

Background: I’m using a wordpress theme called skt full width. I am modifying their front page slideshow, so that it displays six random images instead of six pre-selected images. I have a custom field in media to select which images could be selected in this lottery to be on the front page. Then there is […]

Accidentally deleted php code in WordPress website

I have a website: . While trying to remove the “continue reading”, I accidentally deleted some code and updated it in the theme editor‘s functions.php. Now the website does not work and here is the error code Parse error: syntax error, unexpected ‘}’ in /home2/efulas/public_html/wp-content/themes/catch-box/functions.php on line 395 How can I fix this?