• Hi,

    Working on a customer site where they have created a custom post type and selected to use the taxonomy tags.

    If a post of this custom post type is displayed the paragraphs within the post show up fine. If a tag is used to view all posts with that tag the paragraphs disappear from posts of the custom type.

    Clicking the tag on an ordinary post shows the excerpt but displaying the custom post type posts by tag shows the full post with no paragraphs.

    Can you help please?
    Thanks

    https://www.ads-software.com/plugins/types/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter paultp

    (@paultp)

    Is there any chance of an answer to this?

    Normal posts are displayed correctly when you click on a tag, posts of custom post types are not; the whole content is shown.

    As I understand it WordPress uses archive.php to display posts when the tag is clicked on if there is no tag.php so presumably it thinks that the whole ontent of the custom post is the excerpt?

    Is that correct? Id that how it should be? Should your plugin not produce a correct excerpt?

    An answer of some sort would be nice.

    Thread Starter paultp

    (@paultp)

    So, with still no sign of the plugin developer, we go digging into the plugin and find this:
    /**
    * set default support options
    */
    $support_fields = array(
    ‘editor’ => false,
    ‘author’ => false,
    ‘thumbnail’ => false,
    ‘excerpt’ => false,
    ‘trackbacks’ => false,
    ‘custom-fields’ => false,
    ‘comments’ => false,
    ‘revisions’ => false,
    ‘page-attributes’ => false,
    ‘post-formats’ => false,
    );
    $data[‘supports’] = array_merge_recursive( $data[‘supports’], $support_fields );

    So as far as I can tell all the support options are set to false (including excerpts).

    I can’t find anywhere in the plugin dashboard to set up the support fields for a custom post type?

    HELLO ?!?

    Thread Starter paultp

    (@paultp)

    This is a waste of time, this plugin is not being supported

    Dear paultp

    This issue is no related to Types plugin. Please check your theme templates.

    More about Template Hierarchy https://codex.www.ads-software.com/images/1/18/Template_Hierarchy.png

    Cheers,
    Marcin

    Thread Starter paultp

    (@paultp)

    I quite understand the template hierarchy thanks.

    Archive.php produces a page of posts related to a particular tag, the WordPress settings are set up to show the post excerpts, normal posts display an excerpt correctly, posts of custom post type display the full post but with formatting removed.

    The issue is that the plugin does not allow full declaration of custom post types so an excerpt is not correctly produced.

    register_post_type provides a “supports” section in the declaration where you can declare support for excerpts. Your plugin does not provide anywhere to declare “supports” elements.

    https://codex.www.ads-software.com/Function_Reference/register_post_type

    Your plugin does not provide anywhere to declare “supports” elements.

    You are wrong.

    Please go to: WP-Admin -> Types, select to edit one of custom post type or add new and expand section “Options”.

    Marcin

    Thread Starter paultp

    (@paultp)

    Already looked there.

    The options part allows you to set some of the arguments for register_post_type, such as “show_in_menu” and “hierarchical” but not all the available arguments are there. One of the arguments that it doesn’t allow you to set (as far as I can see) is the “supports” argument which is of the form of an array.

    If it does please show me where it does as I can’t see it, I’m tempted to put up a screen shot.

    Then try “Display Sections” …

    Thread Starter paultp

    (@paultp)

    “Display sections” determines what is displayed when you edit a new custom post type after declaring it.

    Why am I having to explain to you how your plugin works? If you don’t know how it works why are you telling me it can do something when it can’t?

    As I’ve already said “register_post_type provides a “supports” section in the declaration where you can declare support for excerpts. Your plugin does not provide anywhere to declare “supports” elements.”

    Why don’t you check this ^^^ then add it to your plugin so it works properly?

    Dear paultp

    I’m sorry but I’m totally lost. I do not understand a problem.

    If is a problem with display excerpt or content – please check you theme.

    If you need to choose what certain CPT supports – just tick or untick it on CPT edit screen – section “Display options”.

    If is another problem, please explain it again.

    Marcin

    Thread Starter paultp

    (@paultp)

    I’ve explained it clearly enough to be honest.

    register_post_type provides a “supports” section in the arguments where you can declare support for excerpts and various other things. Your plugin does not provide anywhere to declare the “supports” argument.

    If you read this:
    https://codex.www.ads-software.com/Function_Reference/register_post_type

    You will see this in the list of arguments:

    supports
    (array/boolean) (optional) An alias for calling add_post_type_support() directly. As of 3.5, boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.
    Default: title and editor
    ‘title’
    ‘editor’ (content)
    ‘author’
    ‘thumbnail’ (featured image, current theme must also support post-thumbnails)
    ‘excerpt’
    ‘trackbacks’
    ‘custom-fields’
    ‘comments’ (also will see comment count balloon on edit screen)
    ‘revisions’ (will store revisions)
    ‘page-attributes’ (menu order, hierarchical must be true to show Parent option)
    ‘post-formats’ add post formats, see Post Formats

    In your plugin code you set all these options to false (see post above) but there isn’t anywhere in the admin section to set them to true so they are always falso so a custom post type registered through your plugin does not support excerpts.

    If a theme tries to display an excerpt from a custom post type registered with your plugin, because it doesn’t support excerpts (as they cannot be declared) what gets passed is the full content of the post (unless you set a custom excerpt).

    What I think you should do is add a part to the Options section that allows people to declare the elements for the “supports” argument.

    I don’t think it could be any clearer.

    In your plugin code you set all these options to false (see post above) but there isn’t anywhere in the admin section to set them to true so they are always falso so a custom post type registered through your plugin does not support excerpts.

    You are looking into defaults.

    This line:

    $data['supports'] = array_merge_recursive( $data['supports'], $support_fields );

    Turn on those fields, which are selected on CPT edit screen.

    See screencasast, how use edit screen.

    https://youtu.be/Tk1dXlPPk6c

    Cheers

    Thread Starter paultp

    (@paultp)

    That link shows how to display the excerpt in the custom post type by clicking excerpt in display options.

    I don’t want to have to write a custom excerpt for every post of a custom post type.

    If you register the custom post type correctly using the argument “supports” and including the option “excerpt” a standard excerpt will automatically be created for each post of that custom post type.

    I am looking at the defaults, I’m looking at the code in your plugin that sets all the “supports” options to default to false. There isn’t anywhere to set them to true. Display Sections doesn’t do it (I’ve tried ticking excerpt there and as far as I can see it determines what displays in the editor screen) and Options should do it (it includes most of the other arguments but not “supports”) but doesn’t.

    I don’t know why you set them all to false as that is the default anyway for every option apart from title and editor according to the codex.

    I think I’m going to test this just to make sure by declaring a custom post type using your plugin and then declaring one exactly the same but including the “supports” argument by coding it directly using register_post_type. I’ll do it on a test site so I can post the results up here so you can see it in black and white.

    Nobody is going to pay me to do this so I’ll have to wait until I have the time.

    There isn’t anywhere to set them to true.

    Here is setup to true, depend on definition:

    array_merge_recursive( $data[‘supports’], $support_fields );

    Please read abut array_merge_recursive function:

    https://php.net/manual/en/function.array-merge-recursive.php

    Nobody is going to pay me to do this so I’ll have to wait until I have the time.

    You do not pay for this plugin too and you can use some other one if Types disappointing you.

    Cheers,
    Marcin

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘No paragraphs when displaying custom posts using post tag’ is closed to new replies.