Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Albatros Desta

    (@albatros-desta)

    Thanks Diagonale, for your reply. I followed your suggestion and added such “icon” code into Custom link into my main horizontal menu on top. I have to say this is the easiest way for sure, but I wouldn’t call it clean, nor actually a solution. It’s rather workaround around Twenty Twenty limitation – actually a hack.
    In the WP panel administration, in Menu screen, instead of having a clean Menu item names, now I have this long and ugly html code, which looks awkward. This makes the page hard to maintain in the future, as there is no meaningful information that this thing is actually a Facebook icon or some other social icon.

    Can’t I really use the originally designed Social Menu outside of Footer, but have to hack the non-social one??

    In the footer-menu-widgets.php I have this code eventually (below), which I can cut out from there (for instance overwrite the file with my own Child theme footer-menu-widgets.php) and put it into the header.php after “<div class=”header-navigation-wrapper”>”. Then I’d need to sort our CSS so it would fit aside, rather then below. I think this should work in practice. This was I’d be able to manage my social menu normally and cleanly in WP Admin panel.
    I am just wondering can I do it more efficiently or is it that just Twenty Twenty limitation?
    What also is ugly here is that that menu has those classes “footer-social-wrapper”, which would appear in the top Header, which could be confusing for further administration (when after a couple of years somebody would into the code).

    
    <?php if ( $has_social_menu ) { ?>
    <nav aria-label="<?php esc_attr_e( 'Social links', 'twentytwenty' ); ?>" class="footer-social-wrapper">
    
    							<ul class="social-menu footer-social reset-list-style social-icons fill-children-current-color">
    
    								<?php
    								wp_nav_menu(
    									array(
    										'theme_location'  => 'social',
    										'container'       => '',
    										'container_class' => '',
    										'items_wrap'      => '%3$s',
    										'menu_id'         => '',
    										'menu_class'      => '',
    										'depth'           => 1,
    										'link_before'     => '<span class="screen-reader-text">',
    										'link_after'      => '</span>',
    										'fallback_cb'     => '',
    									)
    								);
    								?>
    
    							</ul><!-- .footer-social -->
    
    						</nav><!-- .footer-social-wrapper -->'
    
    Thread Starter Albatros Desta

    (@albatros-desta)

    Tnank you for answering my questions

    Thread Starter Albatros Desta

    (@albatros-desta)

    Thanks, not that easy to change though. In total 22 places in 2 css files concerning media query. I have changed all occurences of this “@media (min-width: 48em)” to this “@media (min-width: 68em)”.

    Thread Starter Albatros Desta

    (@albatros-desta)

    Thank you again for quick reply, Patryk.

    But I have problem more fundamental than passing params from Child Theme.
    I cannot even dequeue your script, because of the error I’ve shown above (the pencil.js script crashes).

    Where am I suppose to dequeue your JS script (‘pencil-scripts’ handle; pencil.min.js)? In functions.php of my Child Theme or in the functions.php of your Parent Theme (and with what priority)?

    If in my Child Theme’s functions, than it does not make sense, as I can only dequeue scripts that are already enqueued, as stated here wp_dequeue_script (“To be dequeued, the script must have been enqueued.”) – AND – my functions.php is loaded “right BEFORE” your functions.php, as stated here advanced-topics/child-themes/ (“it is loaded right before the parent’s file”).

    It would make sense if I would dequeue from your script after enqueuing, or with some ordered priority like, but than this change would be lost after update, so it’s also no good. I’ve tried everything and I still cannot dequeue your file without any errors.

    It looks like I can’t get the order and dependencies, right. It’s quite complex here.

    Thread Starter Albatros Desta

    (@albatros-desta)

    Actually I can’t get that Child Theme to work.

    When I activate it, and run dequeue your pencil.min.js (‘pencil-scripts’ handle), and enqueue my changed one JS (in my Child Theme functions.php), I got error in browser console:

    pencil.min.js?ver=1.1:2 Uncaught ReferenceError: pencil is not defined
        at HTMLDocument.<anonymous> (pencil.min.js?ver=1.1:2)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)
    (anonymous) @ pencil.min.js?ver=1.1:2
    i @ jquery.js?ver=1.12.4:2
    fireWith @ jquery.js?ver=1.12.4:2
    ready @ jquery.js?ver=1.12.4:2
    K @ jquery.js?ver=1.12.4:2.

    Which points to this line of pencil.js:
    var pageNum = parseInt(pencil.startPage, 10) + 1;".
    I cannot get this to work.

    This is my functions.php:
    https://www.dorozkarnia.pl/new_wordpress_2/wp-content/themes/pencil-child/functions.php.txt

    Also some messages you got entered in function “pencil_scripts()”, like “loadMoreText”, and this cannot be modified by Child Theme, I believe. Plus “requires” commands (eg. “/inc/template-tags.php”), that cannot be handled by WordPress dependencies, so I cannot modify those otherwise than directly in your code…
    Do you really think a sensible Child Theme can be created out of this Theme?

    Thread Starter Albatros Desta

    (@albatros-desta)

    A good point, thank you. We’ll do that. I’ll let you know in case of any issues.

    Thread Starter Albatros Desta

    (@albatros-desta)

    Great, that’s exactly what I was looking for.

    What if I just modify the pencil.js/pencil.min.js file manually and upload it /overwrite it via FTP?

    Your solution would allow to leave your .JS file untuouched, but just override it with modified one. Is that it?

    Jan
    Ps. Thank you for rapid response!

Viewing 7 replies - 1 through 7 (of 7 total)