Forum Replies Created

Viewing 15 replies - 1 through 15 (of 70 total)
  • Thread Starter pmdci

    (@pmdci)

    Uff… I actually came to this point:

    <?php
    require( '../../../wp-load.php' );
    global $query_string;
    $url = $_SERVER['REQUEST_URI'];
    parse_str($url, $query);
    query_posts($query_string . '&post_type=post&name=' . $query['name']);
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php echo $query['name']; ?><br />
    <?php echo $query['test']; ?>

    Basically my retarded code ignores the first query of the URL for some reason (that is, the one with the question mark), but it does accept what is followed by the ampersand. For example:

    contact-info?name=Sheraton&test=hello

    This would return all the posts, with the echo “hello” on the top of each of them.

    contact-info?test=hello&name=Sheraton
    This would then return only the post with the slugname “Sheraton” (which is what I am trying to do this whole time). However, it should also return an echo of $test with the value “hello”, but it doesn’t. So this proves to me that the first URL query, for some reason I don’t know, if being disregarded.

    Any ideas why? I’m stuck on this one… ??

    Thread Starter pmdci

    (@pmdci)

    Here is the code I made so far. If I load contact-info.php it shows me all the custom of telephones and emails for all my posts (Hotels). But if I try to use contact-info.php?name=<hotel-name> query argument in the URL, it simply ignores it (still shows all posts)… What am I doing wrong?

    If I hard code a hotel name in the query_posts() function, then it shows the data for that particular.

    <?php
    require( '../../../wp-load.php' );
    global $query_string;
    $paged = get_query_var("paged");
    $url = $_SERVER['REQUEST_URI'];
    parse_str($url, $query);
    query_posts($query_string . "&name=" . $query['name'] . "&paged=" . $paged);
    global $more;
    $more = 0;
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <caption>CONTACT INFO</caption>
     <tr>
    	<td style="text-align:center"><span><?php echo get_post_meta($post->ID, 'telephone_hotel', true); ?></span></td>
     </tr>
     <tr>
    	<td style="text-align:center"><span><?php echo get_post_meta($post->ID, 'email_hotel', true); ?></span></td>
     <tr>
    </table>
    <div class="dhr-bot"></div>
    
    <?php
    // This is a test, and so far it returns nothing. Why is that?
    echo $query['name']; ?> 
    
    	<?php endwhile; else: ?>
    
    		<div><h3>Not Found</h3></div>
    
      <?php endif; ?>
      <?php wp_reset_query(); ?>

    Any ideas?

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    By the way, I moved the subject of this topic to https://www.ads-software.com/support/topic/404629 which I think is more to the point of what I was trying to do and shows the limitations of WP. I was hoping that this would attract people’s attention to the issue and perhaps collaborate on how to find a solution for it, but I got no luck (which is often the case).

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    @anointed,

    I gave up on some of the pretty permalink stuff. I think that what I got so far is enough for now.

    Are you sure you found me? I didn’t get any request. Shame this forum system doesn’t allow Private Messages…

    In the meantime I am picking my brains up with a quite odd request. Perhaps you have seen something like this being done before? Here is the link: https://www.ads-software.com/support/topic/411092

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    @leroy12

    I didn’t managed to make is_singular('post_type') to work. But is_single() && $post_type == 'post' worked.

    Thread Starter pmdci

    (@pmdci)

    I solved the problem with t31os_’s suggestion. Thanks a lot dude!

    <?php
      $post_type = get_post_type( $post );
      if ( is_single() &&  $post_type == 'post' ) { include 'dashboard.php'; } ?>
      <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    Thread Starter pmdci

    (@pmdci)

    @od3n:

    I just tried your idea of using is_singular($post_type) and it didn’t work. Here is my sidebar.php sample:

    <?php // stats da anunciante
      if ( is_single() &&  is_singular('post') ) { include 'dashboard.php'; } ?>
      <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    [...]

    Basicaly I am getting the same behaviour with is_singular($post_type) as if using is_post_type(), as described by our chap t310s_. That is, it returns true as long as $post_type is a registered post type in my WP system.

    Would you be kind enough to share your example with us, so we can see how you made it work? According to the is_singular article in the codex, it doesn’t have any example of this function supporting arguments (i.e.: post types, as in your example of is_singular('post')). If it does accept then the codex should be updated, and you would be doing the WP community a great favour and helping us with the documentation =)

    In the meantime, I will now try t31os_’s suggestion of using $post_type = get_post_type( $post ); and see where I can go with it… =(

    Thread Starter pmdci

    (@pmdci)

    Hey anointed,

    A quick question. According to https://codex.www.ads-software.com/Theme_Development, I can add a template file called taxonomy.php (eg.: city.php). So if I do browse to /city/rome in my site, it would display the custom template.

    My question is, I created a custom taxonomy called city, which has various terms: Rome, Madrid, London, Barcelona, New York, etc.

    What I need is to ensure that I can have custom META keywords for their permalinks, such as: /city/rome, /city/madrid, etc.

    How do you think is the best way to accomlish this? Do I need yet more templates?

    What do you think?

    BTW, do you use any sort of instant messaging online? Would be cool to exchange ideas in a more fast and efficient way ??

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    Ohhh dude… You are THE man. Thanks for this!!! Awesome… I’ll have a look and see if it suit our needs.

    Thread Starter pmdci

    (@pmdci)

    ah,

    I have a puzzler at this post: https://www.ads-software.com/support/topic/406038

    Perhaps you could give me a hand with it? It is way beyond my PHP skills… ??

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    I see,

    Well I managed to make something like: /cities/rome and cities/madrid work without any issues. But only with the default post type. For the custom post type “partner”, I have to do /partners/?city=rome or /partners/?city=madrid

    note by the URL that I am loading a custom page template partners. If I tried something like /partner/city/rome it wouldn’t work.

    ——–

    Something that also doesn’t work for me is to query a category from a custom taxonomy: /city/rome/?category=5-stars

    But the inverse, that is to query a custom taxonomy from a category, works: /category/5-stars/?city=rome

    As far as I understood, the class you mentioned on this post sorts this last issue?

    Thread Starter pmdci

    (@pmdci)

    anointed,

    Don’t know if I am missing the point here, but as per the previous posts, wouldn’t creating a page to query these specific posts “movies & television” do the trick? Say I created a template page-movies-tv.php:

    /movies-tv/?genre=classic

    Now, /movies-tv/ is the permalink of page-movies-tv.php, which was created to query the posts of type “movies & tv”

    I am not sure I understood you correctly. Perhaps your issue is when you try to go to the archive permalink of the post type. Say:

    /movie-or-tv/casablanca
    /movie-or-tv/scarface

    Is that correct?

    I also have the same problem, but I thought that the class you proposed above would sort out this issue.

    Thread Starter pmdci

    (@pmdci)

    If I install this class, should I remove the gd-taxonomy-tools?

    I don’t think that removing or deactivating it would remove my existing custom post types and taxonomies, right? Sicne they are already on th WP db…

    Thread Starter pmdci

    (@pmdci)

    Hi anointed.

    Just one question. Have you tried the gd-taxonomies-tools plug-in?

    Just wondering if this code you sent me wouldn’t has been tested with this plugin, since I use it.

    Cheers,
    P.

    Thread Starter pmdci

    (@pmdci)

    Thanks anointed!

    I’ll have a look…

    Cheers,
    P.

Viewing 15 replies - 1 through 15 (of 70 total)