WordPress.org

Ready to get started?Download WordPress

Forums

Make widget content clickable (17 posts)

  1. oneruffryder
    Member
    Posted 1 year ago #

    Hi , all ! I m hoping that i m on the right place.So to be short for the start,things are like this.I bought a theme and theme´s autor doesnt offer any support.I have modified already a lot of stuff on this theme,but on the last thing i hit a dead end.I m newbie at this and php is not so familiar to me,as i am more "trial & error" guy for wordpress.

    So on the top of this site is a scoreboard inside which i manually enter scores.What i want is to make all of this scores clickable so on click they would open a proper link for that post.

    I need to edit a widget file and add a link code around several DIVs.I guess but i dont know how.I have a separate widget for this scoreboard but some coding for it is inside theme function as well.

    If is it necessary to add this widget file please let me know.Thanks

  2. hiphopinenglish
    Member
    Posted 1 year ago #

    Looking at your source code, the div that you need to make clickable is

    <div class="score-teams">
    Lyon<br />
    Montp
    </div><!--score-teams-->

    Exactly how to that is difficult (impossible) to say without seeing some of your code. Could you show the widget code you have?

  3. oneruffryder
    Member
    Posted 1 year ago #

    i dont know is it ok to add it here,due to some rules..as i said i m new.I have tried to sent a code to your inbox,but cant find it :D

    This is somesite which i find to upload code,so here it is - view

  4. oneruffryder
    Member
    Posted 1 year ago #

    And i forgot to add from themefunction 2 parts..first to register this and the second one - view

  5. oneruffryder
    Member
    Posted 1 year ago #

    Link is gone when i re-edited post so themefunction code is here

  6. hiphopinenglish
    Member
    Posted 1 year ago #

    OK, explain exactly what you want each team or score to link to.

  7. oneruffryder
    Member
    Posted 1 year ago #

    Well i have the option to add scores manually which is the only option to add it.So when i add it i want to have another texarea there to add a link.So any scores which i enter will point to any link which i add inside.

    (i manage to do add this,and to enter link,but the score was not clickable,i guess i needed to add more functions,but thats is something i dont know )

    I think thats much easier then the 2nd option that scores link automatically,because on that way i would have to change a much more.

    If i m not clear,let me know.thanks

  8. hiphopinenglish
    Member
    Posted 1 year ago #

    I would try, in your Custom Post Type code, adding

    array(
    
                'name' => 'Home Team Link',
    
                'desc' => 'Enter home team link (profile or page)',
    
                'id' => $prefix . 'home_team_link',
    
                'type' => 'text',
    
    	    'std' => ' 0'
    
            )
    
    	array(
    
                'name' => 'Away Team Link',
    
                'desc' => 'Enter away team link (profile or page)',
    
                'id' => $prefix . 'away_team_link',
    
                'type' => 'text',
    
    	    'std' => ' 0'
    
            )	
    
        )

    on line 179 (approx.) after your other array entries which create your Meta Boxes.

    Then, in your Plugin code on line 147 onwards, it should be like this:

    <div class="score-teams">
                    <a>ID, "away_team_link", true); ?>"><?php echo get_post_meta($post->ID, "gd_away_team", true); ?></a>
                    <a>ID, "home_team_link", true); ?>"><?php echo get_post_meta($post->ID, "gd_home_team", true); ?></a>
                  </div><!--score-teams-->
                  <div class="score-right">
                    <a>ID, "away_team_link", true); ?>"><?php echo get_post_meta($post->ID, "gd_away_team", true); ?></a>
                    <a>ID, "home_team_link", true); ?>"><?php echo get_post_meta($post->ID, "gd_home_team", true); ?></a>
                  </div><!--score-right-->

    You may wish to also add an alt attribute to make things nicer.

    Let me know if that works.

  9. oneruffryder
    Member
    Posted 1 year ago #

    Ok i will try ASAP...but i m not sure i understand where to add the first part of code ? Custom Post Type code ? is this inside theme function and the second one inside scoreboard.php ?

  10. oneruffryder
    Member
    Posted 1 year ago #

    I got it...but when i tried to add and save the first page i got this

    "Parse error: syntax error, unexpected T_ARRAY, expecting ')' .. functions.php on line 604

  11. hiphopinenglish
    Member
    Posted 1 year ago #

    Sorry, the first code goes in your theme's functions file.

  12. hiphopinenglish
    Member
    Posted 1 year ago #

    Yeah, apologies, I missed some commas.

    Your functions (from line 100 to the end of the section) should look like this:

    Pastebin

  13. oneruffryder
    Member
    Posted 1 year ago #

    Yes i got it.The first one i m adding to theme function but it gives this error.On line 604 which comes exactly on the second part of code array(

  14. hiphopinenglish
    Member
    Posted 1 year ago #

    Which line? (Paste the new code on Pastebin)

  15. oneruffryder
    Member
    Posted 1 year ago #

    Ok,i replaced and doesnt show any errors.Still you can see on the homepage how it looks like .Still doesnt work.

    I notice you wrote a code with home team and away linking.Is that necessary ? Because i thought to build so the home & away team with score would be basically one link or link inside div ..any idea what could i try also ? thank you

  16. hiphopinenglish
    Member
    Posted 1 year ago #

    We've made a mistake somewhere. Hmmm... yes, that would be better. I had understood that you wanted to link to a team's profile, rather than a match post containing updates.

    If I've understood correctly now, can you change the first bit yourself (remove one of the two arrays we added in step one, and rename the other match_page or something)?

    The second would need to have just that echo statement in an atag covering lines 72 and 73, and then again covering 76 and 77.

    I can probably write that in the morning if you can't do it yourself.

  17. oneruffryder
    Member
    Posted 1 year ago #

    ok..so complete themefunction now looks like this

    and scoreboard widget like this

    If i understood propely inside scoreboard i replaced (<div class="score-teams">) all with your code

    Would it be ok,if i contact you trough your Hip Hop FB page ?So i dont need to reload every few seconds here ?

  18. hiphopinenglish
    Member
    Posted 1 year ago #

    Sure. Go ahead.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags