Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    shwetapandya5
    @shwetapandya5
    I want to create carbon fields in wp-emerge theme Anyone here who can guide me?
    2 replies
    shwetapandya5
    @shwetapandya5

    I want to create carbon fields in wp-emerge theme Anyone here who can guide me?

    I am using wp-emerge plugin

    Wade Koehn
    @wkoehn
    On the route conditionals, I can't seem to use 'is_search'. Pardon my ignorance here as I'm very new, but other conditionals are working fine for me, like 'is_woocommerce' and 'is_archive'. Now I'm wanting to route woocommerce product search results...
    Atanas Angelov
    @atanas-dev
    @wkoehn I just tested this locally and it seems to work for me. Could you please share the route definition? Also make sure there's no other route with a conditional that matches the search page and is defined before this one e.g. if you have a is_woocommerce route defined before the is_search one (in the case of product-only search results).
    Wade Koehn
    @wkoehn
    @atanas-dev Ha, just figured out what my issue was. I had a home page route defined like url( '/' ). Since the wordpress search results page looks like example.com/?=... this was always routing search urls to the home page :)
    Wade Koehn
    @wkoehn
    where( 'is_front_page' ) is working great instead for me
    Atanas Angelov
    @atanas-dev
    Glad to hear you figured it out :+1:
    Wade Koehn
    @wkoehn
    On a similar topic, what is the best method to ensure a specific route does NOT get handled by wpemerge? In my case, I have a multi-vendor woocommerce plugin that isn't working correctly unless I make sure I'm not using "route()->all()". I'd like to explicitly define an exception for all pages that meet a condition on the multi-vendor store pages and make sure they are never handled by wpemerge.
    Something like:
    \App::route()->get()->where( 'is_vendor_store' )->return $original_template;
    Atanas Angelov
    @atanas-dev

    I can't test this right now but I think the following should work if you remove ->all():

    \App::route()
        ->any()
        ->where( function () {
            // add some logic here to determine if WP Emerge should take over (return true) or not (return false) e.g.
            return ! is_vendor_store();
        } )
        ->handle();

    The above is almost the same as ->all() but with a custom condition applied.

    Luc D
    @LucArthos_gitlab
    hey all. i'm having trouble with internet explorer (oh surprise) who doesn't load the custom fonts (oh surprise). i'm looking into it, and trying to make the site preload fonts with a link tag in the header. is there a way to automatically get (like from manifest or some variable) the custom fonts in /resources/fonts or should I keep an updated array in my code? thx :)
    Atanas Angelov
    @atanas-dev
    IIRC the manifest should include them and the keys will include the path e.g. "fonts/...":
    Luc D
    @LucArthos_gitlab
    thanks!
    Luc D
    @LucArthos_gitlab
    ok, after yarn dev, yarn build:debug and yarn build, my manifest.json only have one font registered: "fonts/index.scss": "fonts/OpenSans-SemiboldItalic.[hash].woff", when the terminal, during the build operations, sees them (all the .eot, .woff, .woff2 and .ttf types). do you confirm that the syntax is alright?
    @font-face {
        font-family: 'Open Sans';
        src: url('~@fonts/OpenSans-Regular.eot');
        src: url('~@fonts/OpenSans-Regular.eot?#iefix') format('embedded-opentype'),
            url('~@fonts/OpenSans-Regular.woff2') format('woff2'),
            url('~@fonts/OpenSans-Regular.woff') format('woff'),
            url('~@fonts/OpenSans-Regular.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
        font-display: swap;
    }
    Atanas Angelov
    @atanas-dev
    Are you using the latest version of the theme?
    Luc D
    @LucArthos_gitlab
    yes sir :)
    v0.16.1
    Luc D
    @LucArthos_gitlab
    everything seems fine in /dist/styles/frontend.css, all the fonts are correctly registered and redirect to the versioned font in /dist/fonts
    Atanas Angelov
    @atanas-dev
    I've added a TODO to investigate this - thanks!
    andre
    @capsular

    Hi, 'yarn build' works, but 'yarn start' suddenly stopped working the way it always did.
    This is what I see after 'yarn start'

    yarn run v1.6.0
    $ cross-env NODE_ENV=development webpack --colors --config resources/build/webpack.development.js
    clean-webpack-plugin: /Users/andremu/dvmsites/secwoo/wp-content/themes/s2/dist has been removed.
    
    webpack is watching the files…
    
    Hash: e9aabc736269276683dd
    Version: webpack 4.44.1
    Time: 3022ms
    Built at: 2020-11-11 15:23:01

    after that all assets are listed, and then tons of messages like this:

    Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/postcss-loader/src/index.js??ref--7-2!node_modules/sass-loader/dist/cjs.js!node_modules/import-glob/index.js!resources/styles/login/index.scss:
        Entrypoint mini-css-extract-plugin = *
        [./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js!./node_modules/import-glob/index.js!./resources/styles/login/index.scss] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??ref--7-2!./node_modules/sass-loader/dist/cjs.js!./node_modules/import-glob!./resources/styles/login/index.scss 240 bytes {mini-css-extract-plugin} [built]
            + 1 hidden module

    after that output stops and no browser window opens. manually open one and entering the dev url doesn't help and altering css files doesn't trigger anything.
    This is not a wpemerge issue, but maybe someone has some insight for me..

    Luc D
    @LucArthos_gitlab
    @capsular what is your wpemerge version (check in composer.json) ?
    andre
    @capsular
    @LucArthos_gitlab "htmlburger/wpemerge": "~0.16.0", "htmlburger/wpemerge-app-core": "~0.16.1"
    Luc D
    @LucArthos_gitlab
    @capsular it seems everything is alright, then. yarn start builds the dev version of the theme and stops. try to do yarn hot : it won't open a new window but when you open your site on its development address, it will be hotloading the changes you make on your (s)css files
    andre
    @capsular
    @LucArthos_gitlab thaaaank you!! I am upgrading from 0.15 and didn't realise that all the yarn commands changed..
    Luc D
    @LucArthos_gitlab
    i had the same problem at first ;)
    Peter Brennan
    @peter-brennan

    Hey Guys, I'm having issues with WP Emerge Theme and WooCommerce Template files. I have created a woocommerce folder in the theme root, and i've been adding template files for modification. I will use the variable add to cart button template file found in templates/single-product/add-to-cart/variable.php. Once I add this file to my theme woocommerce folder, I get an error saying Undefined variable: attributes...

    Is there something I'm missing or doing wrong?

    Peter Brennan
    @peter-brennan

    Did a fresh install with the following:

    wordpress 5.5.3
    woocommerce 4.7.0
    wpemerge theme 0.16.1

    I can confirm the woocommerce template overrides work with the vanilla theme using the built in view templating service.

    When I install the blade templating service the woocommerce template files are still loaded as expected but the variables passed through to the template is not reaching or populating too late, idk.

    ErrorException (E_ERROR)
    Undefined variable: attributes (View: /Users/peterbrennan/Sites/localhost/wpemerge/wp-content/themes/wpemerge/woocommerce/single-product/add-to-cart/variable.php)
    Previous exceptions
    Undefined variable: attributes (8)
    Luc D
    @LucArthos_gitlab
    @peter-brennan so you say there is a variable $attributes that is not defined when the theme loads? what if you try to create this variable ahead? either via a route (\MyApp::route()->any()->with($variable = 'testvariable')->handle() or another way?
    or suppress the $attribute variable from your theme file?
    correction:
    \MyApp::route()->any()->with($attributes = 'testVariable')->handle();
    Atanas Angelov
    @atanas-dev
    @peter-brennan I managed to reproduce the issue and crate a fix. Could you please follow these steps to make sure the fix works for you:
    1. Edit composer.json and change "htmlburger/wpemerge-blade": "^0.16.0" to "htmlburger/wpemerge-blade": "dev-master#e40a42010809c6cb0911cb4f5d6e68ef21f1f36f as 0.16.0"
    2. Run composer update htmlburger/wpemerge
    Peter Brennan
    @peter-brennan
    @atanas-dev Thank you heaps mate, I thought I was going mad thinking I was missing some minor detail. That fix works wonderfully, you have saved me! Much appreciated, have a great day mate!
    Atanas Angelov
    @atanas-dev
    Woo has its own way of loading templates so it adds a bunch of complexity to get Blade working properly with it.
    Happy to help :)
    Wade Koehn
    @wkoehn

    Hmm, this might be somewhat related to the woo issues just discussed above. But I'm seeing that on a single product page, is_woocommerce() returns true and my view is applied. However, when I add to cart, the page reloads to display the "added to cart" message and this bypasses the view entirely. Here is the template hierarchy applied on the working single product page:

    Template File
    vendor/htmlburger/wpemerge/src/view.php

    Template Hierarchy
    single-product-album.blade.php
    single-product-album.php
    single-product.blade.php
    single-product.php
    single.blade.php
    single.php
    singular.blade.php
    singular.php
    index.blade.php
    index.php

    And here is what I get after adding the product to cart and the page reload:

    C:/Users/**/Local Sites/voa/app/public/wp-content/plugins/woocommerce/templates/single-product.php

    Template Hierarchy
    single-product-album.blade.php
    single-product-album.php
    single-product.blade.php
    single-product.php
    single.blade.php
    single.php
    singular.blade.php
    singular.php
    index.blade.php
    index.php

    Wade Koehn
    @wkoehn
    I've worked around this for now by implementing AJAX add to cart on single product pages, but I'd still like to understand what is happening here if anyone has an idea.
    Atanas Angelov
    @atanas-dev
    It's a bit hectic these days - I'll take a look as soon as I can. In the mean time apart from ajax you could expand your route condition to include something like is_woocommerce() || is_singular( 'product-album' ) (or whatever matches your product post type). If it still doesn't work then maybe Woo is doing stuff with a higher hook priority (and I will take a look).
    Atanas Angelov
    @atanas-dev
    I just game it a test and I can't reproduce it - MyApp::route()->any()->where( 'is_woocommerce' )->handle(); works when adding a product to cart as the template is still taken over by WP Emerge. If you still experience the issue I'd need a reproduce case in order to investigate.
    Atanas Angelov
    @atanas-dev
    @LucArthos_gitlab I've fixed the fonts manifest issue in htmlburger/wpemerge-theme@40ce6ae
    It should apply cleanly so you can
    1. Download https://github.com/htmlburger/wpemerge-theme/commit/40ce6aea4b1f222c7dd039b4d506724d340969e0.diff
    2. Run git apply 40ce6aea4b1f222c7dd039b4d506724d340969e0.diff
    3. Run yarn install
      and you'll be good to go.
    Luc D
    @LucArthos_gitlab
    I can confirm it's good for me, thank you Atanas!
    Luke
    @lucasan
    Hi all, I have a question, I need to force download a pdf, I would like to make it happen from a Controller, but it seems that at that time some headers have been already sent so it causes an error. Am I maybe missing something? Or definitely a Controller is not the place to make this happen?
    thanks
    maybe a question for @atanas-dev :)
    Atanas Angelov
    @atanas-dev
    Hi @lucasan ,
    No output should have happened before a controller has finished doing its thing - my suggestion would be to check if there is unexpected output due to an error or misbehaving plugin before your controller runs.
    A controller is usually the place for a thing like this so instead of return \MyApp::view() you would use something like this:
    return \MyApp::response()
        ->withHeader( 'Content-Type', 'application/pdf' )
        ->withHeader( 'Content-Disposition', 'attachment; filename="my-pdf-name.pdf"' )
        ->withBody( \GuzzleHttp\Psr7\stream_for( fopen( ABSPATH . '/wp-content/uploads/my-pdf-name.pdf', 'r' ) ) );
    Luke
    @lucasan
    thanks @atanas-dev , indeed it was a third party plugin causing the error. Thanks a lot!
    Atanas Angelov
    @atanas-dev
    Happy to help :)
    codemonkeynorth
    @codemonkeynorth
    hi. if I have a blade file foo-alt.blade.php with @extends('foo') is there a way it can run foo.blade.php's ViewComposer ?
    codemonkeynorth
    @codemonkeynorth
    would be useful to be able to do a wildcard like View::addComposer('foo-*', FooViewComposer)
    Atanas Angelov
    @atanas-dev
    There's no wildcard support but you can pass an array of views: View::addComposer( ['foo', 'foo-alt'], FooViewComposer )