Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    I followed the instructions in your link, and I added the following code to my functions.php file:

    // ===== AMP support for custom post type "filmlink" =====
    
    add_action( 'amp_init', 'amp_add_filmlink' );
    function amp_add_filmlink() {
    	add_post_type_support( 'filmlink', AMP_QUERY_VAR );
    }

    Works perfect!

    Then I added the following for my second custom post type:

    // ===== AMP support for custom post type "filmlink-kategorie" =====
    
    add_action( 'amp_init', 'amp_add_filmlink-kategorie' );
    function amp_add_filmlink-kategorie() {
    	add_post_type_support( 'filmlink-kategorie', AMP_QUERY_VAR );
    }

    This breaks the whole website and results in an error 500. Why?

    Plugin Author Weston Ruter

    (@westonruter)

    In your second example you have an illegal function name “amp_add_filmlink-kategorie”. Switch the “-” to an “_” and it should be fine.

    The error 500 is now gone – thanks!

    However, the AMP version is not displayed (page not found) – but I guess the reason for this is that “filmlink-kategorie” is a taxonomy, and taxonomy archives are not supported.

    Plugin Author Weston Ruter

    (@westonruter)

    If filmlink-kategorie is indeed a taxonomy, then no, it won’t work yet.

    Otherwise, when you get a 404 like this, try also going to the Permalinks options page and re-save. This will flush the rewrite rules and allow for the /amp/ to be recognized.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom post’ is closed to new replies.