I'm creating a theme using the CF Post Formats plugin. But I've run into some trouble I don't know how to solve. Here's what I want to be able to do: Create a new standard-format post Enter a url into the _format_link_url custom field If the custom field is not empty, on save/update, change the post format to 'link'; else, remain 'standard'. For whatever reason, I can't get set_post_format to work in this context (perhaps there's a conflicting update?). I …
How can I copy and paste comment threads (and sometimes the original post) from Facebook into WordPress (or elsewhere) and preserve exact formatting? Screenshot? ok, but text etc is better. Both + link would be ideal. When I paste now, the thread/paragraph structure is intact, but the "likes" etc and profile pic thumbnails don't display. I don't need my whole page/site to look like Facebook, just the content of some pasted posts. Ideally a screenshot would be displayed as a …
I need to get posts through wp-json having "standard" as their format. I've been trying different methods like using WP_Query like this. function get_blog_posts() { $posts = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => 4, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'operator' => 'NOT EXISTS', ), ), )); if (empty($posts)) { return null; } return $posts->posts; } add_action( 'rest_api_init', function () { register_rest_route( 'unicorn/v1', '/blog-posts', array( 'methods' => 'GET', 'callback' => 'get_blog_posts', )); }); Get them through GET …
I use the following codes to get posts only from 'image' post format and it works. <?php if( has_post_format('image')){ ?> <?php the_post_thumbnail(); ?> <?php } ?> I also need to get posts only from 'standard' post format with the following codes, but it get post from all post formats. <?php if( has_post_format('standard')){ ?> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> <?php } ?> Any solutions?
I have a function in my wordpress theme that deletes the first embedded video in a video post. See code below. This is in the functions.php file. /* - function that hides first video in post content - */ function process_embed( $embed ){ if ( is_single() && get_post_format() === 'video' ) { static $post_video_num = 0; $post_video_num++; // Hide first video in the post content on single video post page if ( 1 === $post_video_num ) { return ''; } …
I've been reading the codex for WordPress closely and am confused about the vague definitions between what a Taxonomy is and what a Category is. For that matter, term is also a word that is used in the description of Taxonomies, but seems used in a manner that hints that it isn't solely limited to a Taxonomy. Both are described as a way to classify and group together posts. I do understand that Taxonomies are a more general form of …
I am trying to set up blog posts so that when an image is added it is wrapped in one div set to float right and when text is added it is wrapped in another div set to float left. So that all images added to posts in the blog will always have images right and text left. have tried using jQuery to wrap all p tags in a div like so jQuery('p').wrap("<div class='post-txt'></div>"); But I cant work out which …
The weight of opinion seems to favour using custom post types instead of custom post formats. I have several custom post types that I want to style in 4 different formats in a way that is not public ie not a category, tag or custom taxonomy. Custom post formats would seem to provide an ideal solution for this - they're built-in functionality, easily implemented, come with handy meta box, easily applied with conditional statements etc. The major draw back being …
i did my best to solve this problem of post formats not showing but i couln't i have checked my screen options and i have added theme support to my functions.php : <?php $ver = wp_get_theme()->get('Version'); add_action('wp_enqueue_scripts', function () use ($ver) { // style wp_enqueue_style('theme-style', get_theme_file_uri('/asset/css/main.css'), array(), $ver, 'all'); // javascript wp_enqueue_script('theme-script', get_theme_file_uri('/asset/js/main.js'), array(), $ver, true); }); add_action('after_setup_theme', function() { add_theme_support('title-tag'); add_theme_support('menus'); add_theme_support('post-thumbnails'); add_theme_support('custom-background'); add_theme_support('custom-header'); add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link ', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) ); …
Hope everyone is having a good day. in WordPress Codex Post Format the image post format is defined as image – A single image. The first tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image. Now i need to know about what title attribute they are talking about in the …
Using WP_Query() I want to display all posts -except- those with the 'image' post_format. I tried this, but it did not work. $args = array( 'relation' => 'NOT', 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . $post_format), ) ), 'paged' => get_query_var('paged') ); query_posts( $args );
If post format is Gallery or another then echo my custom text. Get post format from post id. I want to do like this code in wordpress post loop if (isset(get_post_format(gallery))){ echo 'Gallery'; } Thanks.
I have renamed my post formats before, but since the Gutenberg update it doesn't work anymore. I tried Aaron's translation-solution from the link below, but WordPress doesn't use the translations in the back end. Is there a new way to do this? I am not experienced enough to be able to dig this out of WordPress myself. The link: Is it possible to rename a post format? This is my attempt: function rename_post_formats( $translation, $text, $context, $domain ) { $names …
I was following a tutorial on youtube and made a post-format page called content-link which uses the post format type of link. The template just contains the following code: <a href="<?php get_the_content(); ?>"><?php echo the_title(); ?></a> The post just has the Title and the content just has a link in it. The Gutenberg puts the link between two comment tags for WP paragraph was causes the link be list with the html version of the comment tags with the link …
When I make a post with a theme that supports (all) post formats, WordPress will suggest the format type it thinks best fits my post. How does it do this? Is it possible to leverage this in, say, my own WP plugin? Update: As far as I know, this is built-in functionality. As shown in the image.
I have enabled Post Formats for Pages on my WordPress site but when I update the Page the format reverts back to Standard. Here is what I added to my functions.php file to enable Post Formats: add_theme_support( 'post-formats', array( 'link' ) ); add_post_type_support( 'page', 'post-formats' );
I have defined quote post format for the theme: // Add post-formats for theme add_theme_support( 'post-formats', array( 'quote', ) ); After it, I want to display quote from the content. For that, I want to use preg_match_all function to search for <blockquote>Hello World.</blockquote> if( $format == 'quote' ) { $content = apply_filters( 'the_content', get_the_content() ); preg_match( '/<blockquote.*?>/', $content, $matches ); } But it is not working. I want to find blockquote tag and display content inside this tag.
I have the standard blog post format and gallery format. I have excluded all the gallery posts from the index.php page so only standard posts show up there. However, the gallery format posts are still being counted for pagination and there is just a blank space on the pagination pages where there would be a gallery post format. How can those be excluded from pagination? <?php echo paginate_links(); ?> I tried this but it didn't help: <?php $args = array( …