Link post to blog from a static page

I'm a WP rookie, and I just designed a static homepage that shows the 3 most recent posts in my database. I would like to redirect the user to another page in order to show him the entire blog post everytime a post title gets clicked. I already created my blog page using the reading settings menu but I can't figure out how to link each post to my blog page and show it's content on it. Any indications?
Category: Web

ACF Relationship - Get Parent's Post Object

I've a few post that have ACF relationship field set up : - Post A - Post A1 - Post A2 - Post A3 Post A have a relationship that link to : Post A1,A2 & A3... Post A1,A2,A3 have their own post templates, But inside the post templates, can I manage to get Post A's Title? Because I don't want hardcoded Post A's title on Post A1,A2,A3's fields. I'd tried this solution, but seems can't retrieve parent A's post …
Category: Web

Fill the exclude array() in get_posts()

I'm using this code to populate the dropdown menu in a meta box. $parents = get_posts( array( 'post_type' => 'jhk_story', 'orderby' => 'ID', 'order' => 'ASC', 'numberposts' => -1, 'exclude' => array(121, 131, 138), ) ); This post_type contains the parents of a post_type 'jhk_frames', which are the only child. So, the children contain in their post_parent field the post_ID of their parent. The parent contains in their post_parent field still the default zero. My question is: how do I …
Category: Web

Front end post delete error confirmation and success message

I am allowing Authors to delete their posts on the front end as they cant access the admin. I have this working, but what bothers me is the standard javascript onclick alert message - is there are way to style a js alert? From my understanding, no. Or to use jQuery for the message and use a modal window that I can style? Also, after deletion the user is returned to the same page which is good, but there is …
Category: Web

How to save template data into wp_post table (post_content column)

Is there a way to save template data into wp_post table? I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users choose a template and write in a standardized format with custom field. Users can now just put some text on my custom field (bottom of my post edit page) and click the template on the sidebar, then the contents show on the post page! And …
Category: Web

How to reload a post page editor after published?

I have a unique website type that only requires 10-20 seconds to make a new post. I want my WordPress site to reload the editor page automatically after a new post has been published hence I don't need to click "Add New" button in order to load blank post editor page.
Category: Web

Working Bootstrap Carousel Conversion to WP - Technical Questions

I have coded a working Bootstrap carousel, it needs to be converted to WP. It's a small chunk of the site, but as a Wordpress newbie, am stuck in understanding the technical issue. So here's what I am trying to do: To show all those posts that have a featured image uploaded to show as a part of the Bootstrap carousel, then to limit the posts per page as needed. As a first step, I thought to not use WP_Query …
Category: Web

How to Get Posts, Including Private Ones?

Currently in one of my php files, I retrieve all of the public posts like this: $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'post' )); However, this only returns public posts, and I would like to store all posts, both public and private, in the $posts variable. How can I accomplish this?
Category: Web

Getting featured image with PHP and not javascript from wordpress api _embed

Not having access to the functions file, I can't add the function to add the featured image to the API so I need to use wp-json/wp/v2/posts?_embed. With javascript I believe it is ._embedded['wp:featuredmedia']['0'].source_url so I tried with php after using wp_remote_get, $post->_embedded['wp:featuredmedia'][0]->source_url but the error I am getting is : Cannot use object of type stdClass as array
Category: Web

Array to string conversion on array_map

I'm using array_map to sort out an array with all of my _octopud_id's. var_dump($offices): Returns the following: array (size=500) 0 => array (size=1) 'id' => string '1382' (length=4) 1 => array (size=1) 'id' => string '1330' (length=4) I need to input that array integer into the 'employees/' section but I can't figure out how - If I hardcode employees/6 I get the following result: object(stdClass)[14592] public 'id' => int 6 What could I be doing wrong? I keep getting the …
Category: Web

Dropdown Select Post Filter

I would like to display the posts when I click on an item with the dropdown select Currently, my select is OK, all my terms are displayed and all posts too. I just want to know of it's possible to filter This is my dropdown select : <select name="soins-taxonomy"> <option value="all">Tout afficher</option> <?php // Get the taxonomy's terms $terms = get_terms( array( 'taxonomy' => 'location', 'hide_empty' => false, 'exclude' => 1 ) ); // Check if any term exists if …
Category: Web

Change the default video URL in a post to shortcode format

I want to add video from youtube/vimeo to my post.Whenever i add a video to my post ,there will display a link like https://www.youtube.com/watch?v=dsUXAEzaC3Q in my admin(Add new post ),and in the front end it will display the video.But the problem is, i want to show the video like a shortcode example [video url=”https://www.youtube.com/watch?v=dsUXAEzaC3Q”][/video]in the place of original video.That is show the shortcode like above instead of the video in front end.How can it possible.Please help me.
Category: Web

previous and next post of same category on singlepost.php

I want to show previous and next posts of same category in wordpress My code is : <?php $prev_post = get_previous_post(); $next_post = get_next_post(); ?> <nav class="post-nav section"> <div class="row no-margin"> <?php // Display the thumbnail of the previous post ?> <div class="col-xs-12 col-sm-6 prev-post" style="padding:0px"> <?php $prevPost = get_previous_post(); $prevthumbnail = get_the_post_thumbnail($prevPost->ID); $post_tile=get_the_title($prevPost->ID); $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($prevPost->ID), 'full' ); ?> <div class="post-nav-thumb" style="background-image: url('<?php echo $thumb['0'];?>')" ></div> <div class="post-nav-content"> <div class="post-nav-subtitle"><?php previous_post_link('%link', 'Prev Post'); ?></div> <h2 class="post-nav-title"><span><?php previous_post_link('%link', $post_tile); …
Category: Web

Get post id outside loop : Notice: Trying to get property of non-object

I am trying to get the post id outside the loop in functions.php.but what error i am getting : Notice: Trying to get property of non-object in functions.php on line 549 function theme_myeffecto_disable() { global $wp_query; $post_id = $wp_query->post->ID; $showreaction = get_post_meta( $post_id, 'post_reaction_show', true ); $showreaction = isset($showreaction) ? $showreaction : true; var_dump($showreaction); } add_action( 'init', 'theme_myeffecto_disable', 20 ); and $showrating always comes false weather it is true or false :(
Category: Web

How to get images only attached from edit post page

I have developed a custom wordpress panel with a custom front-end recently. In single post pages there is a slider. I display the result of get_attached_media( 'image' ) function as the images of slider. I told editor that upload only the images you would like to see in slider to post from edit post page, upload other images from the media link on the side menu. The problem is that, if the user uploads an image from media screen, then …
Category: Web

Adding div to WordPress page content

I am wondering if there is a way to add div to specific elements in the WordPress page content? For example, I would want to wrap a div around content starting at a H2 element and ending after an img element. The div should have custom classes assigned to them. Is there anyway to do this? I don't want to have to hard-code the div so that other people can easily edit the page content. Thanks!
Category: Web

creating a custom post template

I want to customize my individual posts. I have an example of what I'm trying to achieve below. Would I make a custom post template for this? If so how would I do this? Or should I add to my single.php? Thanks in advance. What I want my individual post pages to look like. I want two pictures side by side that are the full width of the page. Text. One picture that is the full width of the page. …
Category: Web

WordPress is creating a lot of draft posts

My WordPress install (with the following plugins) randomly creates Draft posts whenever I load the posts page. Is there a way to find out which plugin is doing this (aside from deactivating)? Has anyone had this problem? Admin Tree View Advanced Custom Fields ACF: Flexible Content Field ACF: Repeater Field Breadcrumb NavXT Disqus Google Analytics Dashboard for WP Google Analytics for WordPress Gravity Forms Gravity Forms Campaign Monitor Add-On iframe IPU-Chart Simple Sitemap sxss Admin Notes TablePress W3 Total Cache …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.