Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author macguru2000

    (@macguru2000)

    Custom data is stored in the meta data of the post, something like this will give you an array of all the catalog item’s custom data.

    <?php $catablog_data = get_post_meta(get_the_ID(), "catablog-post-meta", true); ?>
    <?php $catablog_data["link"]; ?>
    <?php $catablog_data["price"]; ?>
    <?php vardump($catablog_data); ?>

    I believe the permalink may also be retrieved simple by using the built in WordPress functions, such as

    <?php the_permalink() ?>
    <?php $permalink = get_permalink( $id ); ?>
    Thread Starter d0100

    (@d0100)

    That isn’t the case. I solved the problem by using the plugin “Mindvalley Post & Get Variables”, I modified it to check if catablog-items $_GET var is set, meaning that it’s being visualized on it’s own page(not in a post).

    Basically this:

    $key = 'catablog-items';
    		if($pos = strpos($key,'[')){
    			$basekey = substr($key,0,$pos);
    			$remainder = substr($key,$pos);
    
    			eval('$value = $_GET[' . $basekey . ']' . $remainder . ';');
    		}else{
    			$value = $_GET[$key];
    		}
    
            if(!empty($value) && is_string($value)){	// is_string() to avoid unnecessary warnings if key is an array
    			return $content;
            }

    Then just call it:

    [ExclusiveContent] can only see me when going to permalink
    [\ExclusiveContent]

    Plugin Author macguru2000

    (@macguru2000)

    Each CataBlog item is a custom post, so when viewing a item’s page (I assumed you meant using the newer public feature) you can very easily fetch the data you want inside the template file, single-catablog-item.php, which is used to render a single catalog item.

    Regardless, I am still confused on exactly what you need or what you are explaining…but since you found a solution I will just leave it be, cheers!

    Thread Starter d0100

    (@d0100)

    Let me try to explain:

    I want some text to appear on the item’s page (ex: http://localhost/wordpress/?catablog-items=herp-derpina), that will not appear when listed on a post.

    So what I did was to create a shortcode that will check if isset(catablog-items), then print the contents (within the shortcode).

    This is interesting and i’m working on a similar idea.

    I tried both method;s macguru2000 gave but none worked for me.
    I have almost exhausted my efforts on this one, but il try again.

    I am working on single-portfolio.php and trying to get the
    information from (admin-list.php, specifically the getDescriptionSummary(). However maybe im going at this wrong. I need to pull the description information from a Catablog Library item.

    I cannot for some reason get this data to show on the single-portfolio.php page.

    Any help would be much appreciated.

    PS, when i add the first snippet of code (your 1st post) it hides all the items and only shows the title. Not sure why but i have played around with it and nothing.

    Plugin Author macguru2000

    (@macguru2000)

    If you create a file called single-catablog-item.php in your theme’s directory then that file will be responsible for rendering single catablog item pages. This allows you to control the page rendering on individual catalog item pages, without changing the page rendering on regular posts or pages.

    Plugin Author macguru2000

    (@macguru2000)

    webfreelance, what context in the site is your single-portfolio.php page being used? Is it part of your WP Theme? Is it a separate script altogether? Can you please try and describe exactly what you want to achieve without any technical code or ideas. Thanks.

    Yes its part of the mono theme. i have modified the theme for my needs.

    I need to get the description data from a library item and add it to the single-portfolio.php page.

    <?php $catablog_data = get_post_meta(get_the_ID(), “catablog-post-meta”, true); ?>
    <?php $catablog_data[“link”]; ?>
    <?php $catablog_data[“price”]; ?>
    <?php vardump($catablog_data); ?>

    this ideas seems to be o track, but for some re4ason it conflicts with this code.

    <?php
    if ( ! get_post_meta( $post->ID, ‘hide_meta’, true ) ) {
    get_template_part( ‘meta’, ‘post’ );
    }
    ?>

    I would ideally like to add the required info script/shortcode to the above code.

    <?php vardump($catablog_data); ?> = <?php var_dump($catablog_data); ?>

    when using this code:

    <?php $catablog_data = get_post_meta(get_the_ID(), “catablog-post-meta”, true); ?>
    <?php $catablog_data[“link”]; ?>
    <?php $catablog_data[“price”]; ?>
    <?php var_dump($catablog_data); ?>

    I get this output: string(0) “”

    If you create a file called single-catablog-item.php in your theme’s directory then that file will be responsible for rendering single catablog item pages. This allows you to control the page rendering on individual catalog item pages, without changing the page rendering on regular posts or pages.

    I tried this but it doesn’t do anything. Are there any steps missing from these instructions?

    Plugin Author macguru2000

    (@macguru2000)

    I am not familiar with your theme, but that doesn’t really matter. Your single-portfolio.php file is used to render pages at specific urls (context), if you could give me an example url structure that uses that file I might be able to give some suggestions. Still, my assumption is that the url (context) that uses your special theme file has no references to CataBlog, and therefor cannot magically load the catalog item you want.

    To explain why your code snippet doesn’t work: you cannot use catalog item data in the single-portfolio.php file unless you first load a designated catalog library item first. When at a CataBlog Public url the catalog item data is automatically loaded, allowing that code block to work. You can load catalog items manually using PHP functions, let me know if you want me to elaborate on this.

    Why do I ask about the context? Because you need to understand that WordPress only know about CataBlog items as pages if you use the “Public” feature. Then the appropriate catalog item is automatically loaded by WordPress when you view the appropriate url (context) in your site’s front-end.

    The single-catablog-item.php file is used to control how single catalog items are rendered when viewing a specific url (context) that is associated with that catalog item. You can find the permalink to that url in the edit catalog item page in admin, right under the title field.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Content for catablog item permalink’ is closed to new replies.