htmly icon indicating copy to clipboard operation
htmly copied to clipboard

How to add custom social buttons? (Independent Publisher theme)

Open ashraf21c opened this issue 1 year ago • 2 comments

Hello, I`m trying to locate the code of social icons included in "independent publisher" theme. I want to add more (custom) ones.

I found these codes: [layout.html.php] <div id="menu-social" class="menu"> <?php echo social();?> </div>

[style.css] lines 2430:2610.. an example is below: #menu-social li a[href*="codepen.io"]::before { content: '\f216'; color: #BBC7D3;

I wasn`t able to find the code that includes the links already set for the social icons. Can you help me? Thanks in advance.

ashraf21c avatar May 16 '24 09:05 ashraf21c

Hello,

The CSS code for the built-in social icon is social-logos.css.

The function: https://github.com/danpros/htmly/blob/5c45a61faa3ff848c45529b50f679d33742e7c2d/system/includes/functions.php#L2392

To include the new link using social() function than we need to modify the core (not recommended).

Try to create custom config in dashboard, example social.codepen than print it in layout.html.php:

<?php echo config('social.codepen');?>

danpros avatar May 16 '24 11:05 danpros

Thank you very much for the reply.. I`ll have a look.

ashraf21c avatar May 16 '24 11:05 ashraf21c

Hello, I tried doing as instructed, but the website halted (HTMLy is not installed)

I did this edit in layout.html.php, and did the requcired change inside the dashboard. (added the code "" (No quotes) and the value "mailto:[email protected]".

This (automatically) caused this change in config.ini

; Framework config. No need to edit. views.layout = "layout"

= "mailto:[email protected]"

As a result, the website halted. (HTMLy is not installed) The problem persists, even after undoing the change and restoring the original file.

I added the last line (below), in config.ini

; Social account social.twitter = "" social.facebook = "https://www.facebook.com/eesoo.e?mibextid=hIlR13" social.instagram = "" social.linkedin = "" social.github = "" social.youtube = "" social.mastodon = "" social.tiktok = "" social.email = "mailto:[email protected]"

The error log says: [21-May-2024 13:23:20 America/Chicago] PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /home2/prizesciedu/public_html/sch/sites/israa-mohammed/system/includes/dispatch.php on line 104 [21-May-2024 13:23:26 America/Chicago] PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /home2/prizesciedu/public_html/sch/sites/israa-mohammed/system/includes/dispatch.php on line 104 [21-May-2024 13:25:19 America/Chicago] PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /home2/prizesciedu/public_html/sch/sites/israa-mohammed/system/includes/dispatch.php on line 104 [21-May-2024 13:25:22 America/Chicago] PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /home2/prizesciedu/public_html/sch/sites/israa-mohammed/system/includes/dispatch.php on line 104 [21-May-2024 13:25:31 America/Chicago] PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /home2/prizesciedu/public_html/sch/sites/israa-mohammed/system/includes/dispatch.php on line 104

I had a look Lines 99-109:

function config($key, $value = null) { static $_config = array();

if ($key === 'source' && file_exists($value))
    $_config = parse_ini_file($value, true);
elseif ($value == null)
    return (isset($_config[$key]) ? $_config[$key] : null);
else
    $_config[$key] = $value;

}

The line #104 is $_config = parse_ini_file($value, true);

Note 1: I tried both "mailto:......." version and "just the email address" version. The problem persists (HTMLy is not installed). Note2: If it matters, this time the theme is Papermod.

ashraf21c avatar May 21 '24 19:05 ashraf21c

Hello,

Please check this line:

PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191

danpros avatar May 22 '24 00:05 danpros

Yes, this is what the log says, but there is none!

(1) PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 There is no ' in line #191 of config.ini. image

(2) PHP Warning: syntax error, unexpected '(' in config/config.ini on line 191 in /system/includes/dispatch.php on line 104 There is no ' in line #104 of dispatch.php. image

(I use Notepad++)

ashraf21c avatar May 22 '24 12:05 ashraf21c

No you should just put:

social.config = "[email protected]"

The <?php echo config(social.email);?> it should paste in template file and not in config file or even in custom config page.

So when adding custom config, you just need to fill social.email for the key and [email protected] for the value. Please read the hint on the page.

danpros avatar May 22 '24 12:05 danpros