php edit for Cufon font replacement

筅森魡賤 提交于 2019-12-02 18:35:31

问题


I am trying to change the color of the menu items on my website but i don't know where in this to add the color code #c3c3c3 that i want to use

<script type="text/javascript">
jQuery(document).ready(function($){
    // Cufon font replacement & text shadows
    Cufon.replace('#sidebar .font, #content .post .font, #card-container .font, #frontwidgets h3, #gallery .gal_item .font, #nicepagination .font',{ fontFamily: 'Junction', textShadow: '#fff 0px 1px' });
    Cufon.replace('#footer .font',{ fontFamily: 'Junction', textShadow: '#000 0px -1px' });
    Cufon.replace('#content .title-container .font, #mainmenu ul.menu li:not(.current_page_item, .current-menu-parent) a.font',{ fontFamily: 'Junction', textShadow: '#<?php echo $color->bg['-4']; ?> 0px -1px' });
    Cufon.replace('#mainmenu ul.menu li.current-menu-item a.font, #mainmenu ul.menu li.current-menu-parent a.font',{ fontFamily: 'Junction', textShadow: 'none' });

    // Fixing menu hovers as cufon can't seem to handle different div-hover colors
    $('#mainmenu').find('ul.menu').children('li:not(.current-menu-item, .current-menu-parent)').hover(
        function () {
            Cufon.replace($(this).find('a.font'),{ fontFamily: 'Junction', color: '#<?php echo $color->bg['0']; ?>', textShadow: 'none' });
        },
        function () {
            Cufon.replace($(this).find('a.font'),{ fontFamily: 'Junction', color: '#<?php echo $color->fg['-2']; ?>', textShadow: '#<?php echo $color->bg['-4']; ?> 0px -1px' });
        }
    );
});
</script>

***NOTE this is a wordpress theme with font replacement by cufon and it replaces whatever is in the css so changing the css does nothing when i do it


回答1:


Your code indicates that the theme probably fetches the colors from database, which means theme author probably made it easy for you to edit these colors via WordPress dashboard, so choice 1 is look around the admin part for these options.

On the other hand, you can do it in a quick'n dirty (but perfectly valid) way, simply edit this part of your code:

<?php echo $color->bg['0']; ?>

<?php echo $color->bg['-4']; ?>

replacing it simply by color codes, like FFFFCC, or FF0000 (no need for # in front of it, as these are already in place as you'll see)




回答2:


Generally menu items are links and you can put the color change code in the css.

For example :

in HTML:

//...
<li><a href="about.php">About Us</a></li>
//...

in your CSS file:

.menu a
{
   color:Black;
}
.menu a:hover
{
   color:Maroon;
}


来源:https://stackoverflow.com/questions/6253581/php-edit-for-cufon-font-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!