Forum Replies Created

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter Aaron

    (@gardi)

    Ups sorry.

    here im sharing the real names of the custom posts.

    https://pastebin.com/TNcZYtrn

    Thread Starter Aaron

    (@gardi)

    Ok so this is the copy paste from the source

    https://pastebin.com/JyS8R20N

    Thread Starter Aaron

    (@gardi)

    _

    Thread Starter Aaron

    (@gardi)

    Ok here is the deal, the forum doesnt allow the broken code to appear. But the first CAT1 is actually like this.

    & l t ; a href= & q u o t ; https://www.xxx.com/actors/michael/& q u o t ; rel=& q u o t ;tag& q u o t ;& g t ;Michael & g t ;/a & g t these are the base codes for the > and < etc. But for some reason, for the first CAT 1 it loaded them as those codes while in CAT 2 they were loaded properly

    Thread Starter Aaron

    (@gardi)

    Alright. after carefull examination this is the resulting code .

    <p>ID:819  CAT1:<a href=&quot;https://www.xxx.com/actors/michael/&quot; rel=&quot;tag&quot;>Michael >/a&gt 
    
    CAT2:</p>Yazar<a href="https://www.xxx.com/actos/michael/" rel="tag">Michael</a>

    There were several other listed actors but i deleted them to clear the code.

    Thread Starter Aaron

    (@gardi)

    it gave out
    ID:819 CAT1:1 CAT2:Person1

    By the way, there are several Actor and Directors are attached to the post. And they are not displaying.

    Thread Starter Aaron

    (@gardi)

    Well ive tried. But it didnt work. It only gives out output as ” 1 ” ( i dont know why only 1)

    <?php if ( $cat1 = get_the_term_list( get_the_ID(), 'actors', '', '', '') ||
          $cat2 = get_the_term_list( get_the_ID(), 'directors', '', '', '' )) {
       if ( $cat1 && $cat2 ) {
          // Plural code
    	  echo 'Crew';
          echo $cat1;
          echo $cat2;
       } else {
          // Singular code
    	  echo 'Person ';
          echo $cat1;
          echo $cat2;
       }
    } ?>
    Thread Starter Aaron

    (@gardi)

    Yes.

    And if i may add that

    _If Actors or Directors exists than

    __ If there is only one of Actors or Directors
    ____Use singular
    __Else
    ____Use plural

    _if no actor or director exist
    /empty/
    _end

    The first condition is the base of what i currenlty use and have. I would like to add on top of that if possible.

    Thread Starter Aaron

    (@gardi)

    Alright for the sake of going one step at a time, what would be the code (or the document i can read so i can implement the code from) for differentiating the singular and plural results

    Like just for the actors.

    <?php if ( get_the_term_list( get_the_ID(), 'actors', true ) {?>
    
    						<?php if $term= (actors) =1  ?>  Actor:
                            <?php echo get_the_term_list( get_the_ID(), 'actors', "", ",", "" ) ?>
    <? if else (actors) >2  ?> 
    
    Actors:
                            <?php echo get_the_term_list( get_the_ID(), 'actors', "", ",", "" ) ?> 
    
                <?php } ?>

    Im looking somewhere along this. (I know the code doesnt work, i just wanted to give an example of what im planing on doing and to give you an idea of what i mean to do)

    Thread Starter Aaron

    (@gardi)

    Im aware this doesnt make sense from the Actor vs Director point of view but basicly the fields “realy values” which are not actors or directors can only have one of the either field as either singular result (like only one actor OR director) or multiple and combined kinda result (in this case Actors and Directors combined to give Crew).

    SO maybe if i said “Person related to the news and Crew members related to the news , would be much better example.

    I understand you example. So im saying, when its multiple, it really is 2 + with both fields and when its singular, its just one of the two fields.

    Thread Starter Aaron

    (@gardi)

    Well its not easy to describe but will give it a try. This is a commercial project thus i cannot go in to details of the “logic” of the examples (like; currently its not possible to dispose of the structure)

    I have 2 post types with similar but separete custom taxonomies. Like, lets say Actors and Directors. In NEWS post, i would like to show them in one box called “Related People”. If no one is related to this News than no box appears (which i did through the /’category1′, true /)

    Upto this point ive managed it. I have no problems with that.

    Now i want to add some more customisation by conditioning the out put to check the number of the out put. As in; if only a person is related to this news than the box will say = “Person Related to this News” And if it is more than 1, than the box should say “People Related to this Post

    Does this make any sense now?

    Thread Starter Aaron

    (@gardi)

    Is it me or does wp has few hundred way of doing the same thing. Im kinda confused with all the answers around the web and cant seem to solve this
    problem.

    Ive read through the doc and used the code but it seems it only works with one taxonmy otherwise it gives “foreach” error. Also coundnt manage to use “if has post more than 3 than use this, if else use this” kinda code.

    Anywayz. Thanks alot vtxyzzy.

    Thread Starter Aaron

    (@gardi)

    Alright we are on the right track. One last (tiny) question.

    echo '<a href="'.get_permalink($post->ID).'">';

    So this code provides the “http:/siteurl/post-id” kinda result.

    But since all my pages are currently built in a static page kinda way; i want to direct them to the pages link rather than a dinamic page.php

    Ive tried something like this but again failed miserably

    echo '<a href="'.get_permalink('xxx/'$post->ID).'">';

    PS : I know of the settings – permalink panel. But this panel is obviously built with dynamic templating in mind. (which is not a bad idea – however does not work with my situation)

    Thread Starter Aaron

    (@gardi)

    Actually just now i had a eureka moment.

    Ive removed the if conditions because “duhh” this is already the index page. Now i m working with this code

    <?php
    // The Query
    query_posts( 'cat=7');
    
    // The Loop
    while ( have_posts() ) : the_post();
    	echo '<li>';
    	echo '<a href="the_title();">';
    	the_title();
    	echo ' - ';
    	the_time('F jS, Y');
    	echo '</a>';
    	echo '</li>';
    endwhile;
    
    // Reset Query
    wp_reset_query();
    ?>

    The site is currently an beta and i cannot publicly write the link. Would you like me to send you a pm?

Viewing 14 replies - 16 through 29 (of 29 total)