• Resolved greg57

    (@greg57)


    Dear Jose,
    as I’m using a photography theme that makes ample use of custom posts (galleries, albums, collections) I was wondering if there was a way to make your plugin work with these.
    Best regards

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jose

    (@giuse)

    Hi @greg57

    officially as written in the plugin description this plugin doesn’t support custom post types, only posts and pages.

    However, it is already prepared for future development.

    If you feel confident adding custom PHP code, using this filter you can add whatever post type:

    add_filter( 'eos_scfm_post_types','my_custom_post_types',90,1 );
    function my_custom_post_types( $post_types ){
        $post_types[] = 'your_custom_post_type1_slug';
        $post_types[] = 'your_custom_post_type2_slug';
    	return $post_types;
    }

    You should replace your_custom_post_type1_slug, your_custom_post_type2_slug … with the slugs of the post types you want to add.

    To know the slug of your custom post types, go to the page in the backend where you see the list of your custom post types. You will see an URL that looks like:

    https://blog.gregorydziedzic.com/wp-admin/edit.php?post_type=your_custom_post_type_slug

    Take the slug written after ?post_type=

    There are not enough tests on the field with custom post types, so I can’t ensure all works for any kind of post type. I already know that for some custom post types it doesn’t work, but for most custom post types it should work.

    To create the mobile version, you will have a button on the single post editing page.
    In the posts list in the backend, you will not see the icon “+” as for normal posts and pages, and you will not see the note “mobile” next to the mobile version. Instead of mobile, you will see “private”.

    If you have a few cases, I suggest trying adding the code above. If you have too many posts where you need the mobile version, maybe it will be a little uncomfortable for you.

    In the future, the custom posts types will be supported, but it will take some time before to say it’s stable for all post types.

    I hope it helps.

    • This reply was modified 4 years, 7 months ago by Jose.
    Thread Starter greg57

    (@greg57)

    Hi Jose, thanks for your answer. For some strange reason I could read it in the email notification but it doesn’t appear in the forum.

    For your information, I believe your plugin can be extremely valuable for photography websites. My use case is a theme (TwoFold) that allows the use of horizontal scrolling for collection display. Looks great on desktop but it’s not user friendly AT ALL on mobile.

    Concerning the php customization you mentioned, which file should the filter be added to?

    I would be very happy to beta test upcoming versions supporting custom post types.

    Best regards

    Grégory Dziedzic

    Hi Jose, thanks for your answer. For some strange reason I could read it in the email notification but it doesn’t appear in the forum.

    When a post/reply with log entries and/or several links is edited within a few minutes after being published, it every now and then pays a visit to the spam queue. But now the (edited) response is live again above.

    Plugin Author Jose

    (@giuse)

    Hi @greg57 you should add that code in functions.php of the child theme or in a custom plugin.

    As I see on the page you shared, it looks you are not using a child theme.
    You could add it in functions.php of your theme, but it would not be a good idea because you will lose it as soon as you update your theme.

    Maybe you can use this tool to quickly create a custom plugin:
    https://josemortellaro.com/wordpress-plugin-builder/

    Past the code in the field “PHP code” and click on “Create Plugin” after checking the agreement. Then click on “Download”. You will have a custom plugin ready to be uploaded on your website and you will not lose the custom code with future theme updates.

    Thread Starter greg57

    (@greg57)

    Thanks for all this. I’ve installed and activated your plugin and it seems to work for posts and pages. I’m now working on a child theme and have edited functions.php as I guess I had to but unfortunately it seems to be one of those cases where it’s not working at all ??

    https://www.dropbox.com/s/cudug7a6jrk710x/Capture%20d%27%C3%A9cran%202020-04-28%2018.07.10.png?dl=0

    Unless I didn’t get it right. Here’s what my functions.php looks like:

    <php
    add_filter( 'eos_scfm_post_types','my_custom_post_types',90,1 );
    function my_custom_post_types( $post_types ){
        $post_types[] = 'gallery';
        $post_types[] = 'album';
        $post_types[] = 'collection';
    	return $post_types;
    }

    have I missed something?

    The start flag for PHP should be
    <?php

    Thread Starter greg57

    (@greg57)

    Yaaaaaaaaaaaay!!!

    I love you all people this is awesome. Thanks to you Tobi and thanks to Jose the creator of the awesome much-needed plugin.

    Take care guys! ??

    Plugin Author Jose

    (@giuse)

    You are welcome @greg57 ! Thank you very much for your words.
    So you have solved, right? Can I close the thread?

    Thread Starter greg57

    (@greg57)

    You’re very welcome. So far so good, go ahead, I’ll open a new one if I have more questions later ??

    Plugin Author Jose

    (@giuse)

    Ok perfect. Yes, if you have questions, don’t hesitate to open a new thread.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘For custom posts?’ is closed to new replies.