• twcstuff

    (@twcstuff)


    Hey! So I am trying to create my own template for likes on BP activities that works Facebook style where it will list 5 usernames then the rest of the count. I have the template written like this:

    <br /><div class="activity-meta-likes"><ul class="tiles">%START_WHILE%<li><a href="%BP_PROFILE_URL%">%USER_NAME%</a></li>%END_WHILE%</ul> <span>and %DYNAMIC_LIKE_COUNT% liked this.</div>

    And I was able to find where one portion of the Users Like Box Template variables are strpos() out of the template. Which is in class-ulike.php (line 415) however when I add my new variable it is not being replaced out. Leading me to believe this file is for core like templates, not for buddypress activities. Correct?

    Here is what I am trying to add as a test to (replacing $out_template with $post_template where I need to):

    if (strpos($out_template, '%DYNAMIC_LIKE_COUNT%') !== false) {
    				$DYNAMIC_LIKE_COUNT = 'Testing';
    				$out_template = str_replace("%DYNAMIC_LIKE_COUNT%%", $POST_PERMALINK, $out_template);
    			}

    I also found where you do some of the buddypress ones in wp-function.php (starting at line 181) but this section didnt work as it seems to be more post/comment driven.

    Any chance you can point out either my error or where I should be looking?

    https://ww.wp.xz.cn/plugins/wp-ulike/

The topic ‘Add custom variables to template’ is closed to new replies.