Notebookcheck

Autor Thema: wordpress  (Gelesen 4757 mal)

TaBa2

  • Einsteiger NB
  • Beiträge: 5
  • Karma: +0/-0
wordpress
« am: Dezember 18, 2013, 11:46:26 »
Hallo liebe Community,

ich habe vor kurzem Wordpress auf meinem Webspace installiert! Alles läuft hervorragend, allerdings benötige ich noch einen Plugin für eine 3-spaltige Website!

Vielleicht weiß ja jemand von euch Rat!  :)

Grüße

La Bü

  • Einsteiger NB
  • Beiträge: 5
  • Karma: +0/-0
Re: wordpress
« Antwort #1 am: April 10, 2014, 09:08:11 »
Hast du mittlerweile was gefunden?
Ich suche auch gute Plugins.
Kann jemand eine Seite empfehlen?

bearks

  • Einsteiger NB
  • Beiträge: 4
  • Karma: +0/-0
Re: wordpress
« Antwort #2 am: Juni 26, 2014, 15:58:40 »
Bin auch noch ein völliger WordPress Neuling, erstelle gerade meinen allerersten Blog. So einfach und intuitiv wie immer behauptet wird finde ich es bisher ja nicht. Insbesondere mit der Formatierung habe ich noch so meine Probleme.
"Technik ist die bewußte Herstellung und Anwendung von Mitteln."

Oberholz

  • Einsteiger NB
  • Beiträge: 7
  • Karma: +0/-0
Re: wordpress
« Antwort #3 am: März 10, 2015, 10:01:07 »
Ich weiß ich grabe ein altes Thema wieder aus, aber ich konnte die Frage einfach nicht unbeantwortet lassen...

Einen Blog mit drei Spalten bekommt ihr ganz einfach, indem ihr ein entsprechendes Theme wählt. Plugins haben da i.d.R. wenig Einfluss. Oder ihr modifiziert den Code des Themes, das ihr gewählt habt einfach selbst.

yasminpriya

  • Gast
Re: wordpress
« Antwort #4 am: März 26, 2016, 12:00:06 »
Requirements

If you’re going to attempt this, I advise the following:

You are using a custom theme or a custom child theme. In other words, your theme won’t have an “update” that will then delete all your changes.
You feel at least somewhat comfortable poking around theme files.
You don’t have to KNOW PHP, but you do have to be comfortable working around it and copying/pasting lines of PHP code.
You have FTP access to your blog so you can edit the theme files if you make a mistake and your blog becomes inaccessible because of a PHP error.
Step #1: Create column CSS

In order to do this, you need to have some CSS column classes in place. Your theme may already have these, or you may have to make them yourself. But basically what you need is a CSS class that acts as a column. Here’s one example for a two-column (so two posts side-by-side) layout:

.half {
   width: 50%;
   float: left;
}
The key thing is in the width. Since I want two columns, I need my div’s width to be half of 100%, which is 50%. If you wanted three columns, you’d need to set the div to one third of 100, which would be 33.3%.

Note: you can name the div whatever you want. I chose “half” just as an example. In order to avoid conflicts, it might be better to prefix it with something, like: ng-half (I chose “ng” here for “Nose Graze”).

Next, we need a div to wrap around the columns and clear the float. For this example, I’ll use:

.ng-row {
   clear: both;
}
Step 2: Finding your theme’s code for the homepage posts

The next step is finding the right file in your theme that outputs the code on the homepage for displaying your posts. In most themes this is the index.php file. However, some themes may have a different structure. For example, in the themes I code, I do have an index.php file, but in that file I tell it to include a separate file, which is where I keep the post code. I call that file loop-archive.php.

Now inside that file, you want to find a very specific block of code:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

[..]

<?php endwhile; ?>
There will be a lot of code in between, but you need to find the bit starting with the if (have_posts()) : while (have_posts()) : the_post(); portion. It may look slightly different from theme to theme, so look carefully. Then you need to find the end bit, which will be <? endwhile; ?>. We’re going to be working in and around this snippet.

This portion of the code is called The Loop. What it does is basically cycle through your WordPress posts. Everything inside that snippet is repeated for each individual post on your homepage.

Step 3: The column code

a) The easy way (may be glitchy)

There is an “easy” way to do this. Right after this line:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Add this code:

<div class="half">
(or whatever your class name was)

And right before this line:

<?php endwhile; ?>
Add this code:

</div>
In the end, your code should look like this:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="half">

[..]

</div>
<?php endwhile; ?>
With the rest of your theme’s code where the [..] bit is. You’re basically just wrapping your posts inside that column div. However, if your posts have varying heights, this could have some weird, unexpected results. There is a more complex method that is a lot more reliable…

b) The more advanced way

The more advanced way looks something like this:

<?php $i = 0; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php
if($i == 0) {
   echo '<div class="ng-row">';
}
?>

<div class="half">

[..]

</div>

<?php
$i++;
if($i == 2) {
   $i = 0;
   echo '</div>';
}
?>

<?php endwhile; ?>

<?php
if($i > 0) {
   echo '</div>';
}
?>
Basically what we’re doing it starting a counter inside the code. We start the count at 0, then begin cycling through the posts. The first step is: if the counter is 0, add the div class for a new row. Then, after that, we insert the div class for a column (<div class="half">), and make sure the rest of the post display stuff from your theme is in there, before closing the div. Then, at the end, we increase the counter by one (so it’s now 1). However, then we need to perform some checks to determine if we should close the row div. Since we want two columns, we say: if the counter is 2, reset the counter to 0, then close the row div.

Once that’s done, The Loop (cycling through the posts) ends with <?php endwhile; ?> But what happens if the loop ends when the counter is only at 1? We won’t have closed the row div! So, we perform one final check at the end: if the counter is greater than 0, close the row div.

And that’s it!

If you’re not familiar with coding, I know this can look kind of confusing and intimidating.. especially if you’ve never seen/touched much PHP before. And since all themes have slightly different structures and layouts, it’s hard to have a “one size fits all” solution. Ultimately, you have to just try to apply the same logic to the theme that you have.

Just change the values for different numbers of columns

If you’re able to get it working with two columns, you can even try making it work with any number! You just have to change the values in the CSS (the div width) and in the PHP counter.
« Letzte Änderung: März 26, 2016, 16:12:21 von Klaus Hinum »

 

 
» Impressum     Sprachen: Deutsch | English | Español | Français | Italiano | Nederlands | Polski | Português | Русский | Türkçe | Svenska
Diese Webseite nutzt Cookies. OK