logo
Tags down

shadow

Grid is not flexible enough to sort the posts


By : user2175574
Date : October 15 2020, 08:10 AM
Hope this helps After couple of days pulling out my hair, I have found a similar layout in Jen Simmons labs: https://labs.jensimmons.com/2016/examples/image-gallery-grid-1.html
This seems to be the closest to what I need, so I'm just going to stick with it and closing this question. !
code :


Share : facebook icon twitter icon

Need flexible nth-child formula for infinite amount of posts


By : Ashker Ali Khan
Date : March 29 2020, 07:55 AM
help you fix your problem You need to use multiple nth-child selectors that override previously styled elements.
Let's say this is the HTML:
code :
<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
  <li>5</li>
  <li>6</li>
  <li>7</li>
  <li>8</li>
  <li>9</li>
  <li>10</li>
  <li>11</li>
  <li>12</li>
</ul>
/* make all li elements green and 75% wide */
li {
  float: left;
  width: 75%;
  background: green;
  padding: 20px; /* for style */
  margin-bottom: 20px; /* for style */
}

/* Make the 'even' ones 25% wide. */
li:nth-child(even) {
  width: 25%;
}

/* Make every 'fourth' one 25% wide and have a red background */
li:nth-child(4n+1) {
  width: 25%;
  background: red;
}

/* Make every fourth one's (starting from 1) adjacent sibling 75% wide */
li:nth-child(4n+1) + li {
  width: 75%;
}

/* Make every fourth one (starting from 4) have a red background */
li:nth-child(4n+4) {
  background: red;
}

ACF - Looping thru posts, then thru flexible content, then thru repeater


By : Devaud Guillaume
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Create an array of the images during the initial posts loop, randomize that array, then output the html in a loop through the images array.
code :
<?php 
    $args = array(
        'post_type' => 'projects',
        'posts_per_page' => '-1',
        'orderby' => 'rand',
    );

    $the_query = new WP_Query( $args );

    if ( $the_query->have_posts() ) : 

        $images = array();

        while ( $the_query->have_posts() ) : $the_query->the_post();
            if( have_rows('the_page_content') ):
                while ( have_rows('the_page_content') ) : the_row();
                    if( have_rows('images') ) :

                        while( have_rows('images') ) : the_row();

                            $image = get_sub_field('square_image');
                            if ( !empty($image) ): 
                                // add image properties and related data to main images array
                                $images[] = array(
                                    'url' => $image['url'],
                                    'title' => $image['title'],
                                    'alt' => $image['alt'],
                                    'postdata' => array(
                                        'id' => get_the_ID(),
                                        'title' => get_the_title(),
                                        'permalink' => get_permalink()
                                    )
                                );
                            endif; 
                        endwhile; //  while(have_rows('images'))
                    endif; //     have_rows('images')
                endwhile; //  have_rows('the_page_content')
            endif; //     have_rows('the_page_content')
        endwhile; //  $the_query->have_posts 

        wp_reset_postdata(); 

    endif; // $the_query->have_posts

    // Loop through the images array and output html for each image
    shuffle($images); // Randomize the order of the images
    $count = 1;
    foreach($images as $img) :
?>
        <div class="row">
            <div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 home-tile-holder">
              <a href="<?php echo $img['postdata']['permalink']; ?>" rel="<?php echo $img['postdata']['title']; ?>">
                  <img src="<?php echo $img['url']; ?>" alt="<?php echo $img['alt']; ?>" class="img-responsive home-tile" />
                  <span class="title"><?php $img['postdata']['title']; ?><br><img src="<?php echo get_stylesheet_directory_uri(); ?>/img/magnify.png"></span>
              </a>
            </div>
        <?php if($count % 6 == 0) echo '</div><div class="row">';?>
        <?php $count++; ?>
    <?php endforeach; ?>
        </div>

XAML - Restrict Width of one TextBlock in flexible Grid, while not restricting other Grid childern?


By : Imperat0r
Date : March 29 2020, 07:55 AM
Does that help I found one simple solution. Although it works in this case, I'm not sure how generally usable or good it actually is. Anyway, I set Width of the restricted TBlock to 1. It shouldn't be 0 because then the optimisation code in its layout methods might bypass some of its layout steps entirely.
Then I bound its MinWidth to its parent Grid's ActualWidth. Since the TBlock doenst have any Margins set, it gives me its desired width.

How can I sort my Wordpress posts by certain criteria (i.e. random, recent posts, custom fields, ect.)?


By : Donna Ackels
Date : March 29 2020, 07:55 AM
it helps some times I searched and searched and couldn't find anything that would work for my project; then it dawned on me: switch statements.
Creating a simple menu:
code :
<div class="sort">
   <a class="recent" href="?sort=recent">Recent</a>
   <a class="random" href="?sort=random">Random</a>
</div>
$order = 'ASC';
$orderby = '';

switch ($_GET['sort']) {
    case 'recent':
        $order = 'DESC';
        $orderby = '';
        break;
    case 'random':
        $orderby = 'rand';
        break;
}

$args = array(
    'post_type' => 'entry',
    'order' => $order,
    'posts_per_page' => 20, // limit of posts
    'orderby' => $orderby,
);
'meta_key' => $metakey,    
'meta_query' => array(
        array(
            'value' => 'customfield'
        ),
    ),

Sort newsgroup-style posts by date, with 'pinned' or 'sticky' posts at the the top. MongoDB


By : ЛОЛ
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You can use an aggregate pipeline
This way :
code :
> db.posts.aggregate([{$project: {document: "$$ROOT", "s": {$gte: ["$detail.isSticky.end",  new Date() ] } } }, {$sort: {"s": -1, "date": -1}} , {$replaceRoot: {newRoot: '$document'}}]).pretty()
{
    "_id" : ObjectId("59b6dab93294aebe7d8b480e"),
    "date" : ISODate("2017-11-02T00:00:00Z"),
    "type" : "published",
    "detail" : {
        "title" : "First! - Sticky today",
        "author" : "Me",
        "content" : "This post IS sticky on today: 11/12 < 11/13 < 11/18",
        "isSticky" : {
            "begin" : ISODate("2017-11-12T00:00:00Z"),
            "end" : ISODate("2017-11-18T00:00:00Z")
        }
    },
    "s" : true
}
{
    "_id" : ObjectId("59b6dab93294aebe7d8b480f"),
    "date" : ISODate("2017-11-01T00:00:00Z"),
    "type" : "published",
    "detail" : {
        "title" : "Second - Sticky today",
        "author" : "Me",
        "content" : "This post IS sticky on today: 11/12 < 11/13 < 11/22",
        "isSticky" : {
            "begin" : ISODate("2017-11-12T00:00:00Z"),
            "end" : ISODate("2017-11-22T00:00:00Z")
        }
    },
    "s" : true
}
{
    "_id" : ObjectId("59b6dab93294aebe7d8b480a"),
    "date" : ISODate("2017-11-10T00:00:00Z"),
    "type" : "published",
    "detail" : {
        "title" : "Third",
        "author" : "Me",
        "content" : "Newest NON-sticky post. Never was sticky.",
        "isSticky" : {

        }
    },
    "s" : false
}
{
    "_id" : ObjectId("59b6dab93294aebe7d8b4811"),
    "date" : ISODate("2017-11-09T00:00:00Z"),
    "type" : "published",
    "detail" : {
        "title" : "Fourth",
        "author" : "You",
        "content" : "No longer sticky: 11/09 < 11/13 !< 11/11",
        "isSticky" : {
            "begin" : ISODate("2017-11-09T00:00:00Z"),
            "end" : ISODate("2017-11-11T00:00:00Z")
        }
    },
    "s" : false
}
{
    "_id" : ObjectId("59b6dab93294aebe7d8b4812"),
    "date" : ISODate("2017-11-08T00:00:00Z"),
    "type" : "published",
    "detail" : {
        "title" : "Last",
        "author" : "Me",
        "content" : "Never was a sticky post",
        "isSticky" : {

        }
    },
    "s" : false
}
Related Posts Related Posts :
  • Overflow: content on left side is hiding on overflow is set to auto
  • Loop over Observable
  • Laravel controller doesn´t process my view parameters
  • put margin on border - css
  • Form table inputs doesn't get aligned in HTML
  • Using flex to achieve two rows and one column layout
  • How to make <textarea> take the size of text
  • Make nested table with table-layout auto, width 100% overflow when window too small
  • Fully cover one div with another div of the same size
  • 16bit canvas with WebGL 1
  • "Elements should not have tabindex greater than zero" - Nonzero Tabindex Breaks Validation & 508 Complianc
  • Dynamic form using *ngFor and submitting values from it
  • Why does Firefox not use CSS from an local absolute path?
  • Bootstrap 4 Card Component Remove unnecessary whitespace
  • Link takes double click to activate- how to make it only one? Angular 5
  • How to center a DIV in the remaining space on RHS of another DIV
  • Yii2 Remove container div specific to every record from listview
  • Charm bar doesn't scroll to bottom
  • Sticky footer is hiding content at the bottom of my website
  • Why I am getting GET vars in a POST form?
  • How do I make the "after" pseudo-element always be on the same line in my table headers?
  • Bootstrap 4 Order div columns
  • Auto-width image with `srcset` attribute
  • How to make the image also have rounded corners?
  • Scrape table for nested table in local html using selenium
  • Fixed side chat menu using flex box
  • Select all siblings if one of them has a specific class
  • HLS / Media Source Extensions <video> with muted & autoplay freezes on first frame on mobiles
  • HTML element doesnt contain all page contents
  • XPath to find elements
  • Target only the first direct child not working despite :nth-child(1)
  • Why nuxt insert all css link into every page with extractCss true
  • User agent stylesheet is overriding my css even though it acknowledges it shouldn't?
  • Basic tags in html clarification
  • CSS Lifted Corners in Foundation 6
  • How to make CSS clip path only reside on top of div?
  • Allow page breaks inside tr and td elements
  • Creating a dropdown menu purely with HTML + CSS
  • How to add vertical space between inputs in a form?
  • Submit button does not pass form data
  • Why a row is stacked in column
  • Button style differs on different screens and devices
  • Text on Left, Icon on Right - Bootstrap
  • CSS — How to blur a SVG mask?
  • Disable the growing ability of an element
  • Line up text over multiple lines under each other?
  • CSS3 Grid fill space in last row
  • Convert six column flex layout into three columns
  • ngModel with select list
  • Spring boot Requested mapping value variable
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org