Before you ask please READ THIS

Adding "View map" button

edited October 2013 in Hypershot Posts: 41
Hi Air,

I would like to use "View map" instead of "Read more" on one of my blog/archive pages, but I will still use the latter on the other pages.

How do I add hooks/shortcodes(?) to the code so that when "<--map-->" (I removed the ! because it gets commented out) appears in the code, "View map" would be used on the page?

Thank you,
LazyDiver

Comments

  • AirAir
    edited November 2013 Posts: 10,608
    In content.php you have
                //manual post cutting
                else{
                    the_content(__fe('Read more' ));
                }
    You could use that and change it to
                //manual post cutting
                else{
                    if(strpos($post->post_content, '<!--map-->')){
                        the_content(__fe('View map' ));
                    }
                    elseif(strpos($post->post_content, '<!--more-->')){
                        the_content(__fe('Read more' ));
                    }
                }
    Now it is only for manual post cutting(previous code was wrong). Now when you write post, and want to show map only if post is viewed you will have to add both tags before map. Your post content should look like this
    Content visible on post list <!--map--><!--more--> rest of post, map code.
    Important thing is that this tags <!--map--><!--more--> have to be added in Text mode of editor, or <&> will be changed to different code and it will not work.

    I have tested this and it works:-)

    With regards.
    Post edited by Air on
  • Hi Air,

    Thanks. I tried that, but I think that's for the auto-excerpt.

    I forgot to tell you that I'm using the manual option, sorry about that. :) How do I edit the manual excerpt option?

    Thanks again for your great support.

  • AirAir
    Posts: 10,608
    Nope, this for manual one, you just have to edit <--map--> to code that will be unique to map.

    With regards.
  • Hi Air,

    Sorry, but I need a little more guidance. How exactly do I change the code in order to show "Read more" and "View more" when I insert <--more--> and <--map-->, respectively, in manual excerpt mode?

    Thanks for your patience,
    LazyDiver
  • AirAir
    Posts: 10,608
    OK I made some mistakes in solution I gave you so please read again my answer and now everything should be clear http://support.apollo13.eu/discussion/comment/7030#Comment_7030
    Sorry for problems.

    With regards.
  • Hi Air,

    It worked, BUT I used <--more--><--map--> instead of the reverse. For future reference. :)

    Thanks for all your help. Great support!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!