Forum Replies Created

Viewing 15 replies - 211 through 225 (of 239 total)
  • Thread Starter jumust

    (@jumust)

    How about this?
    It gives me error but looks good:

    <?php
     $just_shown = $last_shown; $last_shown = array(); $output = '';
     foreach((get_the_category()) as $category) {
     $catname = $category->cat_name;
     if(!in_array($catname,$just_shown)) {
     $cat = get_category($category->term_id); //new line to show only top level cat name
     if(!$cat->parent) {
       $output .= $catname . ' ';
       if ($cat->cat_name == 'Events') {
          $termids = get_term_children($cat->term_id,'category');
          $sep = '';
          foreach ($termids as $termid) {
            $childname = get_cat_name($termid);
             $output .= $sep . $childname;
             $sep = ', ';
          }
       }
    }
     $last_shown[] = $catname;
     }
     if($output != '') {
      echo '<div class="sectioncat">' . $output . '</div>';
     }
    ?>

    Thread Starter jumust

    (@jumust)

    It gives me this error
    Parse error: syntax error, unexpected T_ENDWHILE in /home/tipsand1/public_html/thingstodoincalifornia.info/wp-content/themes/diarise/index.php on line 209

    Thread Starter jumust

    (@jumust)

    Sorry could you please send me all the code I need, because I don’t know where replace it.
    Just keep in mind that I need this line because I don’t want to show the category header if the previous post belongs to the same category check it out

    $just_shown = $last_shown; $last_shown = array(); $output = '';

    and I need the category header to be in the class “sectioncat”:

    if($output != '') {
      echo '<div class="sectioncat">' . $output . '</div>';
     }

    Thanks very much

    Thread Starter jumust

    (@jumust)

    Hi Alchymyth,
    thanks for your help.

    What I’d like is show the child category that belongs to that particular post and Never show the parent “Events” (and if I select two or more children I’d like these to be separated by comma)

    So If I have a post in Parent “Events” and Children “Music” and “Local Events” I’d like to see in the header of the post:
    “Music, Local Events”

    This should be only for “Events” category and only for the home page.

    Please let me know if you need more info.

    Thanks very much!

    Thread Starter jumust

    (@jumust)

    Hi Alchymyth,
    please let me know I can hire you for that.
    This is my request: I have Category headers for each post and they show the Parent Category.
    Now only for “Events” Category I’d like headers to show the children categories separated by comma.

    Here is the code you sent me last time:

    <?php
     $just_shown = $last_shown; $last_shown = array(); $output = '';
     foreach((get_the_category()) as $category) {
     $catname = $category->cat_name;
     if(!in_array($catname,$just_shown)) {
     $cat = get_category($category->term_id); //new line to show only top level cat name
     if(!$cat->parent) { $output .= $catname . ' '; } //new if statement
     }
     $last_shown[] = $catname;
     }
     if($output != '') {
      echo '<div class="sectioncat">' . $output . '</div>';
     }
    ?>

    Thanks for all

    Thread Starter jumust

    (@jumust)

    Thanks vtxyzzy!!!
    I have just a question:

    Should I merge your code with mine? Or just use your code?

    As I need to use

    $just_shown = $last_shown; $last_shown = array(); $output = '';
    and the output
    <div class="sectioncat">' . $output . '</div>';

    to accomplish this objective: have the category header above each post and if two posts belong to the same category, just show one time the header…you can check it out here

    Thanks

    Thread Starter jumust

    (@jumust)

    Hi Alchymyth,
    I’m again here to ask you a hand if it’s possible.
    I need to make a couples of little tweaks in the code you kindly sent me.

    In the Home Page I have this code:

    <?php
     $just_shown = $last_shown; $last_shown = array(); $output = '';
     foreach((get_the_category()) as $category) {
     $catname = $category->cat_name;
     if(!in_array($catname,$just_shown)) {
     $cat = get_category($category->term_id); //new line to show only top level cat name
     if(!$cat->parent) { $output .= $catname . ' '; } //new if statement
     }
     $last_shown[] = $catname;
     }
     if($output != '') {
      echo '<div class="sectioncat">' . $output . '</div>';
     }
    ?>

    I’d like to use an if…else statement in the home page I guess, in order to have posts that belong to “Events” category show only children categories separated by comma in the header (and never show the header “Events”).

    So I tried to use <?php if (in_category(‘events’)) : ?> and edit your code but I got lost.

    Here is what I did:

    <?php if (in_category('events')) { ?>
    echo '<?php $just_shown = $last_shown; $last_shown = array(); $sep = ''; $output = '';
     foreach((get_the_category()) as $category) {
     $catname = $category->cat_name;
     if(!in_array($catname,$just_shown)) {
     $cat = get_categories('parent='.$category->term_id);
     if(!$cat) { $output .= $sep . $catname; $sep = ', '; }
     }
     $last_shown[] = $catname;
     }
     ?>'
    else
    echo '<?php
     $just_shown = $last_shown; $last_shown = array(); $output = '';
     foreach((get_the_category()) as $category) {
     $catname = $category->cat_name;
     if(!in_array($catname,$just_shown)) {
     $cat = get_category($category->term_id); //new line to show only top level cat name
     if(!$cat->parent) { $output .= $catname . ' '; } //new if statement
     }
     $last_shown[] = $catname;
     }
     if($output != '') {
      echo '<div class="sectioncat">' . $output . '</div>';
     }
    ?>' <?php } ?>

    Thanks for your help!!!

    Thread Starter jumust

    (@jumust)

    I’m in trouble…any ideas?

    Thread Starter jumust

    (@jumust)

    Nobody has any idea about how to move this custom field above the title of RSS Feed post?
    I’m in troubleeeeeeeeee!!!!!!!

    Please help!
    Thank you

    Thread Starter jumust

    (@jumust)

    Hi,
    I added this code in the function.php

    function wpbeginnerb_postrss($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $address = get_post_meta($postid, 'address', true);
    if(is_feed()) {
    if($address !== '') {
    $content = '<br /><span style="margin-top:0px; margin-left:164px; font-size:12px; font-family: Tahoma bold; color: #000000;">'.$address .'</span><br />'.$content ;
    }
    else {
    $content = $content;
    }
    }
    return $content;
    }
    add_filter('the_excerpt_rss', 'wpbeginnerb_postrss');
    add_filter('the_content_feed', 'wpbeginnerb_postrss');

    I found it here https://www.wpbeginner.com/wp-tutorials/how-to-add-content-and-completely-manipulate-your-wordpress-rss-feeds/ in the section “Add a Custom Field to your WordPress RSS Footer” but I edited it to not show in the footer but somewhere before the content (I added style in the span tag). Here is my sample email template: E-mail

    Now I’m wondering if I can move the custom field above the Title and not above the Content, should I change $content with $title….

    Thanks so much

    Thread Starter jumust

    (@jumust)

    SOLVED
    I FIGURE OUT THIS EDIT IN THE STYLESHEET.CSS OR CUSTOM.CSS

    .nav li ul {
    background:none repeat scroll 0 0 transparent;
    border:medium none;
    width:542px;
    }

    Play around with width so you can have columns.

    Ok, I hope you can edit your plugin and grab featured images too.
    Thanks

    My purpose is definitely to have separate blogs and not use this plugin for spam.
    I’m building a websites community for a US State. They want to post all of the stuff happens in each single city within each single city-blog. But definitely there are events or shops, or etc… that need to be published on more than one city-site: EX. it’s like if you are from Seattle but you are pretty interested in what’s going on in Vancouver, so the concert is coming up, must be published on Vancouver site and obviously on Seattle site, too.
    Hope it makes sense and let you understand why I need to broadcast posts with their custom fields.

    Thanks

    My purpose is definitely to have separate blogs and not use this plugin for spam.
    I’m building a websites community for a US State. They want to post all of the stuff happens in each single city within each single city-blog. But definitely there are events or shops, or etc… that need to be published on more than one city-site: EX. it’s like if you are from Seattle but you are pretty interested in what’s going on in Vancouver, so the concert is coming up, must be published on Vancouver site and obviously on Seattle site, too.
    Hope it makes sense and let you understand why I need to broadcast posts with their custom fields.

    Thanks

    Hi arpitap,
    I’m really in trouble because I can’t find a solution for that…that’s crazy because WP3 Multisite is a new feature to use WP as CMS and post on multi-sites, but finally it doesn’t work at all, and you still need to create manually all the posts for the other sub-blogs.

    Hopefully anyone build a plugin for that! Thanks

    Please let me know any progress so we can help each other.

    Cheers

Viewing 15 replies - 211 through 225 (of 239 total)