WordPress.org

Ready to get started?Download WordPress

Forums

My Content Management
Displaying customized content via PHP? (4 posts)

  1. markcj
    Member
    Posted 1 year ago #

    I have created a custom post type - 'resources'

    That post type has a set of custom categories, such as 'audience'

    Doing no other customizing, I go to http://mysite.com/resources-category/audience/ and get pretty much what I expect - a list of the 'resources' which I have categorized as 'audience'.

    But - this list does not use any of the custom templates defined in 'my content management' - how can I get this to use the custom templates?

    In PHP I tried do_shortcode("[..]") with no success, even though I had copied in a shortcode that works fine when I post it in a page (I want to use PHP to easily modify this code as people select different categories from a list).

    And to confuse me more, when I click on the post title in that list - I get the single entry at the link http://mysite.com/resource/entry-slug/ - this time, it DOES use the custom template for full listings, which is great - except that the {terms} code used in the custom template doesn't display anything (it does when I use the shortcode for the full listing on a Page).

    So - either I need to figure out how to format this via PHP, or figure out how to tell WP to use one of the custom templates, or - the simplest - figure out how to get the do_shortcode() function to work.

    http://wordpress.org/plugins/my-content-management/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    Several answers here:

    The archive page isn't filtered; so it will just use the default archive template provided by your theme. You can customize that by creating a custom template using the theme template hierarchy here:

    http://codex.wordpress.org/Template_Hierarchy

    That {terms} issue sounds like a bug; I'll have to investigate it, however.

    Alternatively, you can create a custom filter to add your custom data to the post data; there are several filters in My Content Management using the standard WordPress filter system (http://codex.wordpress.org/Function_Reference/add_filter) for just that reason.

    Using do_shortcode(), you could be running into a quotes issue: you have to make sure that your quotes are correctly nested or escaped inside the function, or the function won't receive a valid shortcode.

  3. markcj
    Member
    Posted 1 year ago #

    Thanks for your help! I got the do_shortcode working.

    Here's the potential bug that's showing up for me.

    You'll see on this page that, using the list template, I'm getting a list of the terms ("categories" as I call them on the page).

    http://gladalliance.org/site/resources/

    And on pages like this one I'm also getting the list of terms from the full template:

    http://gladalliance.org/site/resources-category/curious/

    Both of those pages are now using a shortcode to display these lists.

    But on pages like this, which access the full template using WP's defaults (2012 theme, which I'm in the midst of modifying), the list of terms is blank [links to these are the titles on the first page linked above]:

    http://gladalliance.org/site/resource/for-the-bible-tells-me-so/

    It will be a few days before I get back to working on this, so these links should show the issue at least until early next week.

    Thanks

  4. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    OK. The terms issue is kind of a combination bug/limitation. The limitation is that WordPress can only retrieve terms if the taxonomy is also provided -- so MCM only retrieve terms if the taxonomy has been specified in a shortcode. You can't specify a shortcode attribute if you're using the default template outputs, so it doesn't return any results.

    It's a bug, as well, because I can set things up so that it will assume that the taxnonomy it should use is the one set up by My Content Management, which is a reasonable fallback. The next release will do this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic